X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=daemon%2Fhexdump.c;h=1b33eeb3acec7a33138cd138d11cb42866649f60;hp=9de602a6714b5a85a9d1da50f6d0d36bc3cea779;hb=c24de46d06cc3ecccf00bfaaffb06172659cdd0a;hpb=fa7c8bb79b45aecdf65ed93635a42f3fdf301134 diff --git a/daemon/hexdump.c b/daemon/hexdump.c index 9de602a..1b33eeb 100644 --- a/daemon/hexdump.c +++ b/daemon/hexdump.c @@ -1,5 +1,5 @@ /* libguestfs - the guestfsd daemon - * Copyright (C) 2009 Red Hat Inc. + * Copyright (C) 2009 Red Hat Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,27 +28,20 @@ char * do_hexdump (const char *path) { - int len; char *buf; int r; char *out, *err; - NEED_ROOT (NULL); - ABS_PATH (path, NULL); - - 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, "hexdump", "-C", buf, NULL); free (buf); if (r == -1) { - reply_with_error ("hexdump: %s: %s", path, err); + reply_with_error ("%s: %s", path, err); free (err); free (out); return NULL;