summaryrefslogtreecommitdiffstats
path: root/test-tool/helper.c
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 /test-tool/helper.c
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 'test-tool/helper.c')
-rw-r--r--test-tool/helper.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/test-tool/helper.c b/test-tool/helper.c
index 3395f219..731b053e 100644
--- a/test-tool/helper.c
+++ b/test-tool/helper.c
@@ -42,32 +42,32 @@ main (void)
if (mkdir ("/tmp", 0700) == -1) {
perror ("mkdir");
fprintf (stderr, "This program should not be run directly. Use libguestfs-test-tool instead.\n");
- exit (1);
+ exit (EXIT_FAILURE);
}
if (geteuid () != 0) {
fprintf (stderr, "helper: This program doesn't appear to be running as root.\n");
- exit (1);
+ exit (EXIT_FAILURE);
}
if (mkdir ("/tmp/helper", 0700) == -1) {
perror ("/tmp/helper");
- exit (1);
+ exit (EXIT_FAILURE);
}
fd = open ("/tmp/helper/a", O_CREAT|O_EXCL|O_WRONLY, 0600);
if (fd == -1) {
perror ("create /tmp/helper/a");
- exit (1);
+ exit (EXIT_FAILURE);
}
if (write (fd, buffer, sizeof buffer) != sizeof buffer) {
perror ("write");
- exit (1);
+ exit (EXIT_FAILURE);
}
if (close (fd) == -1) {
perror ("close");
- exit (1);
+ exit (EXIT_FAILURE);
}
- exit (0);
+ exit (EXIT_SUCCESS);
}