summaryrefslogtreecommitdiffstats
path: root/hivex
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2009-11-20 12:09:42 +0100
committerRichard Jones <rjones@redhat.com>2009-11-20 12:14:14 +0000
commitc372c7c23a298a940b8a0868396ef2ae0d824e4d (patch)
tree2c6bec16fd926e0bfd357c2623864f19f666decf /hivex
parente94f89f40d989d111882178c87b5bfc22314fca8 (diff)
downloadlibguestfs-c372c7c23a298a940b8a0868396ef2ae0d824e4d.tar.gz
libguestfs-c372c7c23a298a940b8a0868396ef2ae0d824e4d.tar.xz
libguestfs-c372c7c23a298a940b8a0868396ef2ae0d824e4d.zip
maint: use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1 to exit
Convert all uses automatically, via these two commands: git grep -l '\<exit *(1)' \ | grep -vEf .x-sc_prohibit_magic_number_exit \ | xargs --no-run-if-empty \ perl -pi -e 's/\b(exit ?)\(1\)/$1(EXIT_FAILURE)/' git grep -l '\<exit *(0)' \ | grep -vEf .x-sc_prohibit_magic_number_exit \ | xargs --no-run-if-empty \ perl -pi -e 's/\b(exit ?)\(0\)/$1(EXIT_SUCCESS)/' * .x-sc_prohibit_magic_number_exit: New file. Edit (RWMJ): Don't change Java code.
Diffstat (limited to 'hivex')
-rw-r--r--hivex/hivexget.c10
-rw-r--r--hivex/hivexml.c16
2 files changed, 13 insertions, 13 deletions
diff --git a/hivex/hivexget.c b/hivex/hivexget.c
index 04c854f1..8cc395a1 100644
--- a/hivex/hivexget.c
+++ b/hivex/hivexget.c
@@ -32,7 +32,7 @@ main (int argc, char *argv[])
{
if (argc < 3 || argc > 4) {
fprintf (stderr, "hivexget regfile path [key]\n");
- exit (1);
+ exit (EXIT_FAILURE);
}
char *file = argv[1];
char *path = argv[2];
@@ -40,19 +40,19 @@ main (int argc, char *argv[])
if (path[0] != '\\') {
fprintf (stderr, "hivexget: path must start with a \\ character\n");
- exit (1);
+ exit (EXIT_FAILURE);
}
if (path[1] == '\\') {
doubled:
fprintf (stderr, "hivexget: %s: \\ characters in path are doubled - are you escaping the path parameter correctly?\n", path);
- exit (1);
+ exit (EXIT_FAILURE);
}
hive_h *h = hivex_open (file, 0);
if (h == NULL) {
error:
perror (file);
- exit (1);
+ exit (EXIT_FAILURE);
}
/* Navigate to the desired node. */
@@ -264,5 +264,5 @@ main (int argc, char *argv[])
if (hivex_close (h) == -1)
goto error;
- exit (0);
+ exit (EXIT_SUCCESS);
}
diff --git a/hivex/hivexml.c b/hivex/hivexml.c
index 9dd394ef..7fb419f9 100644
--- a/hivex/hivexml.c
+++ b/hivex/hivexml.c
@@ -59,7 +59,7 @@ static struct hivex_visitor visitor = {
do { \
if ((proc args) == -1) { \
fprintf (stderr, "%s: failed to write XML document\n", #proc); \
- exit (1); \
+ exit (EXIT_FAILURE); \
} \
} while (0)
@@ -80,19 +80,19 @@ main (int argc, char *argv[])
break;
default:
fprintf (stderr, "hivexml [-dk] regfile > output.xml\n");
- exit (1);
+ exit (EXIT_FAILURE);
}
}
if (optind + 1 != argc) {
fprintf (stderr, "hivexml: missing name of input file\n");
- exit (1);
+ exit (EXIT_FAILURE);
}
hive_h *h = hivex_open (argv[optind], open_flags);
if (h == NULL) {
perror (argv[optind]);
- exit (1);
+ exit (EXIT_FAILURE);
}
/* Note both this macro, and xmlTextWriterStartDocument leak memory. There
@@ -105,7 +105,7 @@ main (int argc, char *argv[])
writer = xmlNewTextWriterFilename ("/dev/stdout", 0);
if (writer == NULL) {
fprintf (stderr, "xmlNewTextWriterFilename: failed to create XML writer\n");
- exit (1);
+ exit (EXIT_FAILURE);
}
XML_CHECK (xmlTextWriterStartDocument, (writer, NULL, "utf-8", NULL));
@@ -113,19 +113,19 @@ main (int argc, char *argv[])
if (hivex_visit (h, &visitor, sizeof visitor, writer, visit_flags) == -1) {
perror (argv[optind]);
- exit (1);
+ exit (EXIT_FAILURE);
}
if (hivex_close (h) == -1) {
perror (argv[optind]);
- exit (1);
+ exit (EXIT_FAILURE);
}
XML_CHECK (xmlTextWriterEndElement, (writer));
XML_CHECK (xmlTextWriterEndDocument, (writer));
xmlFreeTextWriter (writer);
- exit (0);
+ exit (EXIT_SUCCESS);
}
static int