X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=daemon%2Fext2.c;h=f46bac9ac474e86a4e6e16bd6257131654fee9fd;hp=a26891b03dc7bf034b2cd3d244c4baec371982e1;hb=088d0c53cfe0dcb20b87707a9055175b2fd6b72f;hpb=2b891ceef355ce2d6532d65f8febbe3833d4399e diff --git a/daemon/ext2.c b/daemon/ext2.c index a26891b..f46bac9 100644 --- a/daemon/ext2.c +++ b/daemon/ext2.c @@ -20,11 +20,12 @@ #include #include +#include #include -#include #include "../src/guestfs_protocol.h" #include "daemon.h" +#include "c-ctype.h" #include "actions.h" char ** @@ -48,7 +49,7 @@ do_tune2fs_l (const char *device) p = out; /* Discard the first line if it contains "tune2fs ...". */ - if (strncmp (p, "tune2fs ", 8) == 0) { + if (STREQLEN (p, "tune2fs ", 8)) { p = strchr (p, '\n'); if (p) p++; else { @@ -72,15 +73,15 @@ do_tune2fs_l (const char *device) if (colon) { *colon = '\0'; - do { colon++; } while (*colon && isspace (*colon)); + do { colon++; } while (*colon && c_isspace (*colon)); if (add_string (&ret, &size, &alloc, p) == -1) { free (out); return NULL; } - if (strcmp (colon, "") == 0 || - strcmp (colon, "") == 0 || - strcmp (colon, "(none)") == 0) { + if (STREQ (colon, "") || + STREQ (colon, "") || + STREQ (colon, "(none)")) { if (add_string (&ret, &size, &alloc, "") == -1) { free (out); return NULL; @@ -202,7 +203,7 @@ do_get_e2uuid (const char *device) } p += 17; - while (*p && isspace (*p)) + while (*p && c_isspace (*p)) p++; if (!*p) { reply_with_error ("malformed Filesystem UUID in the output of tune2fs -l"); @@ -212,7 +213,7 @@ do_get_e2uuid (const char *device) /* Now 'p' hopefully points to the start of the UUID. */ q = p; - while (*q && (isxdigit (*q) || *q == '-')) + while (*q && (c_isxdigit (*q) || *q == '-')) q++; if (!*q) { reply_with_error ("malformed Filesystem UUID in the output of tune2fs -l");