diff options
author | Jim Meyering <meyering@redhat.com> | 2009-11-20 12:09:42 +0100 |
---|---|---|
committer | Richard Jones <rjones@redhat.com> | 2009-11-20 12:14:14 +0000 |
commit | c372c7c23a298a940b8a0868396ef2ae0d824e4d (patch) | |
tree | 2c6bec16fd926e0bfd357c2623864f19f666decf /examples/hello.c | |
parent | e94f89f40d989d111882178c87b5bfc22314fca8 (diff) | |
download | libguestfs-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 'examples/hello.c')
-rw-r--r-- | examples/hello.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/hello.c b/examples/hello.c index 8b36ed44..b4d5d8c6 100644 --- a/examples/hello.c +++ b/examples/hello.c @@ -19,18 +19,18 @@ main (int argc, char *argv[]) if (argc != 3 || access (argv[1], F_OK) != 0) { fprintf (stderr, "Usage: hello disk-image partition\n"); - exit (1); + exit (EXIT_FAILURE); } - if (!(g = guestfs_create ())) exit (1); + if (!(g = guestfs_create ())) exit (EXIT_FAILURE); - if (guestfs_add_drive (g, argv[1]) == -1) exit (1); + if (guestfs_add_drive (g, argv[1]) == -1) exit (EXIT_FAILURE); - if (guestfs_launch (g) == -1) exit (1); + if (guestfs_launch (g) == -1) exit (EXIT_FAILURE); - if (guestfs_mount (g, argv[2], "/") == -1) exit (1); + if (guestfs_mount (g, argv[2], "/") == -1) exit (EXIT_FAILURE); - if (guestfs_touch (g, "/hello") == -1) exit (1); + if (guestfs_touch (g, "/hello") == -1) exit (EXIT_FAILURE); guestfs_sync (g); guestfs_close (g); |