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]
/
hivex
/
hivexget.c
diff --git
a/hivex/hivexget.c
b/hivex/hivexget.c
index
04c854f
..
3e89d63
100644
(file)
--- a/
hivex/hivexget.c
+++ b/
hivex/hivexget.c
@@
-27,12
+27,14
@@
#include "hivex.h"
#include "hivex.h"
+enum { EXIT_NOT_FOUND = 2 };
+
int
main (int argc, char *argv[])
{
if (argc < 3 || argc > 4) {
fprintf (stderr, "hivexget regfile path [key]\n");
int
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];
}
char *file = argv[1];
char *path = argv[2];
@@
-40,19
+42,19
@@
main (int argc, char *argv[])
if (path[0] != '\\') {
fprintf (stderr, "hivexget: path must start with a \\ character\n");
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);
}
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);
}
hive_h *h = hivex_open (file, 0);
if (h == NULL) {
error:
perror (file);
- exit (
1
);
+ exit (
EXIT_FAILURE
);
}
/* Navigate to the desired node. */
}
/* Navigate to the desired node. */
@@
-82,7
+84,7
@@
main (int argc, char *argv[])
/* else node not found */
fprintf (stderr, "hivexget: %s: %s: path element not found\n",
path, p);
/* else node not found */
fprintf (stderr, "hivexget: %s: %s: path element not found\n",
path, p);
- exit (
2
);
+ exit (
EXIT_NOT_FOUND
);
}
p = pnext;
}
p = pnext;
@@
-103,7
+105,7
@@
main (int argc, char *argv[])
goto error;
/* else key not found */
fprintf (stderr, "hivexget: %s: key not found\n", key);
goto error;
/* else key not found */
fprintf (stderr, "hivexget: %s: key not found\n", key);
- exit (
2
);
+ exit (
EXIT_NOT_FOUND
);
}
/* Print the value. */
}
/* Print the value. */
@@
-264,5
+266,5
@@
main (int argc, char *argv[])
if (hivex_close (h) == -1)
goto error;
if (hivex_close (h) == -1)
goto error;
- exit (
0
);
+ exit (
EXIT_SUCCESS
);
}
}