git.annexia.org
/
libguestfs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix error handling in 'zero' function.
[libguestfs.git]
/
daemon
/
ext2.c
diff --git
a/daemon/ext2.c
b/daemon/ext2.c
index
a26891b
..
f46bac9
100644
(file)
--- a/
daemon/ext2.c
+++ b/
daemon/ext2.c
@@
-20,11
+20,12
@@
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
#include <unistd.h>
-#include <ctype.h>
#include "../src/guestfs_protocol.h"
#include "daemon.h"
#include "../src/guestfs_protocol.h"
#include "daemon.h"
+#include "c-ctype.h"
#include "actions.h"
char **
#include "actions.h"
char **
@@
-48,7
+49,7
@@
do_tune2fs_l (const char *device)
p = out;
/* Discard the first line if it contains "tune2fs ...". */
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 {
p = strchr (p, '\n');
if (p) p++;
else {
@@
-72,15
+73,15
@@
do_tune2fs_l (const char *device)
if (colon) {
*colon = '\0';
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 (add_string (&ret, &size, &alloc, p) == -1) {
free (out);
return NULL;
}
- if (
strcmp (colon, "<none>") == 0
||
-
strcmp (colon, "<not available>") == 0
||
-
strcmp (colon, "(none)") == 0
) {
+ if (
STREQ (colon, "<none>")
||
+
STREQ (colon, "<not available>")
||
+
STREQ (colon, "(none)")
) {
if (add_string (&ret, &size, &alloc, "") == -1) {
free (out);
return NULL;
if (add_string (&ret, &size, &alloc, "") == -1) {
free (out);
return NULL;
@@
-202,7
+203,7
@@
do_get_e2uuid (const char *device)
}
p += 17;
}
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");
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;
/* 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");
q++;
if (!*q) {
reply_with_error ("malformed Filesystem UUID in the output of tune2fs -l");