X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=daemon%2Fchecksum.c;h=bd71182a2a6d19e6e01a16b07518f0d7a9f68133;hb=966dbd977f12b639169a48042b558834f627e5f8;hp=bb30b05eb7fb89010d4d38fedeb5ceedb1a3a944;hpb=a7b73d4a1e09f12b2002083618056f0c823c1dcf;p=libguestfs.git diff --git a/daemon/checksum.c b/daemon/checksum.c index bb30b05..bd71182 100644 --- a/daemon/checksum.c +++ b/daemon/checksum.c @@ -33,7 +33,8 @@ do_checksum (char *csumtype, char *path) const char *program; char *buf; char *out, *err; - int r, len; + int r; + int len; NEED_ROOT (NULL); ABS_PATH (path, NULL); @@ -58,13 +59,11 @@ do_checksum (char *csumtype, char *path) } /* Make the path relative to /sysroot. */ - len = strlen (path) + 9; - buf = malloc (len); + buf = sysroot_path (path); if (!buf) { reply_with_perror ("malloc"); return NULL; } - snprintf (buf, len, "/sysroot%s", path); r = command (&out, &err, program, buf, NULL); free (buf);