X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=daemon%2Fchecksum.c;h=13719fd71b6a9e1354fbbe3860a7b3dc6785b303;hp=499d19db9c33857ff74e7c4e9d75dbb1c61a31d9;hb=d054dfb2f948f53188f448d2c7fade83db9bbab8;hpb=9353c6253d5fac1648b13ad9958468a2d9f6ad6f diff --git a/daemon/checksum.c b/daemon/checksum.c index 499d19d..13719fd 100644 --- a/daemon/checksum.c +++ b/daemon/checksum.c @@ -27,11 +27,10 @@ #include "daemon.h" #include "actions.h" -char * -do_checksum (const char *csumtype, const char *path) +static char * +checksum (const char *csumtype, const char *path) { const char *program; - char *buf; char *out, *err; int r; int len; @@ -55,15 +54,7 @@ do_checksum (const char *csumtype, const char *path) return NULL; } - /* Make the path relative to /sysroot. */ - buf = sysroot_path (path); - if (!buf) { - reply_with_perror ("malloc"); - return NULL; - } - - r = command (&out, &err, program, buf, NULL); - free (buf); + r = command (&out, &err, program, path, NULL); if (r == -1) { reply_with_error ("%s: %s", program, err); free (out); @@ -79,3 +70,24 @@ do_checksum (const char *csumtype, const char *path) return out; /* Caller frees. */ } + +char * +do_checksum (const char *csumtype, const char *path) +{ + /* Make the path relative to /sysroot. */ + char *buf = sysroot_path (path); + if (!buf) { + reply_with_perror ("malloc"); + return NULL; + } + + char *r = checksum (csumtype, buf); + free (buf); + return r; +} + +char * +do_checksum_device (const char *csumtype, const char *device) +{ + return checksum (csumtype, device); +}