X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=daemon%2Fsfdisk.c;h=95f04af460a24f67287602a333b8260b838ff4d1;hb=3dfc0a8c5da8f3a4a6c13e936d4306b79b231dde;hp=9d7a220f8a15802350295e0a511d74de57cb241d;hpb=5cd39c83e23eb300d1bdfa806902a31b409ff420;p=libguestfs.git diff --git a/daemon/sfdisk.c b/daemon/sfdisk.c index 9d7a220..95f04af 100644 --- a/daemon/sfdisk.c +++ b/daemon/sfdisk.c @@ -30,7 +30,7 @@ #include "actions.h" static int -sfdisk (const char *device, int n, int cyls, int heads, int sectors, +sfdisk (char *device, int n, int cyls, int heads, int sectors, char * const* const lines) { FILE *fp; @@ -39,7 +39,7 @@ sfdisk (const char *device, int n, int cyls, int heads, int sectors, IS_DEVICE (device, -1); - strcpy (buf, "/sbin/sfdisk --no-reread"); + strcpy (buf, "/sbin/sfdisk"); if (n > 0) sprintf (buf + strlen (buf), " -N %d", n); if (cyls) @@ -51,6 +51,9 @@ sfdisk (const char *device, int n, int cyls, int heads, int sectors, /* Safe because of IS_DEVICE above: */ sprintf (buf + strlen (buf), " %s", device); + if (verbose) + printf ("%s\n", buf); + fp = popen (buf, "w"); if (fp == NULL) { reply_with_perror (buf); @@ -75,15 +78,15 @@ sfdisk (const char *device, int n, int cyls, int heads, int sectors, } int -do_sfdisk (const char *device, int cyls, int heads, int sectors, - char * const* const lines) +do_sfdisk (char *device, int cyls, int heads, int sectors, + char **lines) { return sfdisk (device, 0, cyls, heads, sectors, lines); } int -do_sfdisk_N (const char *device, int n, int cyls, int heads, int sectors, - const char *line) +do_sfdisk_N (char *device, int n, int cyls, int heads, int sectors, + char *line) { const char *lines[2] = { line, NULL }; @@ -91,7 +94,7 @@ do_sfdisk_N (const char *device, int n, int cyls, int heads, int sectors, } static char * -sfdisk_flag (const char *device, const char *flag) +sfdisk_flag (char *device, const char *flag) { char *out, *err; int r; @@ -112,19 +115,19 @@ sfdisk_flag (const char *device, const char *flag) } char * -do_sfdisk_l (const char *device) +do_sfdisk_l (char *device) { return sfdisk_flag (device, "-l"); } char * -do_sfdisk_kernel_geometry (const char *device) +do_sfdisk_kernel_geometry (char *device) { return sfdisk_flag (device, "-g"); } char * -do_sfdisk_disk_geometry (const char *device) +do_sfdisk_disk_geometry (char *device) { return sfdisk_flag (device, "-G"); }