X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=daemon%2Fswap.c;h=fbeb895f63a0178984b256fbe52c9f3d5f7f0e75;hb=e9c37113104c1cfb234535adc9b52ad3880a41ce;hp=bcc5f1b13529e76228c627e3ede30ad91da78538;hpb=84fc760439e82e6b3616abd0d1f9bd7d7eb01ec0;p=libguestfs.git diff --git a/daemon/swap.c b/daemon/swap.c index bcc5f1b..fbeb895 100644 --- a/daemon/swap.c +++ b/daemon/swap.c @@ -26,6 +26,25 @@ #include "../src/guestfs_protocol.h" #include "daemon.h" #include "actions.h" +#include "optgroups.h" + +/* Convenient place to test for the later version of e2fsprogs + * and util-linux which supports -U parameters to specify UUIDs. + * (Not supported in RHEL 5). + */ +int +optgroup_linuxfsuuid_available (void) +{ + char *err; + int av; + + /* Ignore return code - mkswap --help *will* fail. */ + command (NULL, &err, "/sbin/mkswap", "--help", NULL); + + av = strstr (err, "-U") != NULL; + free (err); + return av; +} static int mkswap (const char *device, const char *flag, const char *value) @@ -39,7 +58,7 @@ mkswap (const char *device, const char *flag, const char *value) r = command (NULL, &err, "/sbin/mkswap", "-f", flag, value, device, NULL); if (r == -1) { - reply_with_error ("mkswap: %s", err); + reply_with_error ("%s", err); free (err); return -1; } @@ -96,7 +115,7 @@ swaponoff (const char *cmd, const char *flag, const char *value) r = command (NULL, &err, cmd, flag, value, NULL); if (r == -1) { - reply_with_error ("%s: %s: %s", cmd, value, err); + reply_with_error ("%s: %s", value, err); free (err); return -1; }