summaryrefslogtreecommitdiffstats
path: root/fish/rc.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 /fish/rc.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 'fish/rc.c')
-rw-r--r--fish/rc.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/fish/rc.c b/fish/rc.c
index a9eb5788..dbaf9535 100644
--- a/fish/rc.c
+++ b/fish/rc.c
@@ -66,7 +66,7 @@ receive_stdout (int s)
cmptr = malloc (controllen);
if (NULL == cmptr) {
perror ("malloc");
- exit (1);
+ exit (EXIT_FAILURE);
}
}
@@ -88,7 +88,7 @@ receive_stdout (int s)
ssize_t n = recvmsg (s, &msg, 0);
if (n < 0) {
perror ("recvmsg stdout fd");
- exit (1);
+ exit (EXIT_FAILURE);
}
h = CMSG_FIRSTHDR(&msg);
@@ -135,7 +135,7 @@ send_stdout (int s)
cmptr = malloc (controllen);
if (NULL == cmptr) {
perror ("malloc");
- exit (1);
+ exit (EXIT_FAILURE);
}
}
cmptr->cmsg_level = SOL_SOCKET;
@@ -152,7 +152,7 @@ send_stdout (int s)
if (sendmsg (s, &msg, 0) != 1) {
perror ("sendmsg stdout fd");
- exit (1);
+ exit (EXIT_FAILURE);
}
}
@@ -192,7 +192,7 @@ rc_listen (void)
pid = fork ();
if (pid == -1) {
perror ("fork");
- exit (1);
+ exit (EXIT_FAILURE);
}
if (pid > 0) {
@@ -217,16 +217,16 @@ rc_listen (void)
sock = socket (AF_UNIX, SOCK_STREAM, 0);
if (sock == -1) {
perror ("socket");
- exit (1);
+ exit (EXIT_FAILURE);
}
unlink (sockpath);
if (bind (sock, (struct sockaddr *) &addr, sizeof addr) == -1) {
perror (sockpath);
- exit (1);
+ exit (EXIT_FAILURE);
}
if (listen (sock, 4) == -1) {
perror ("listen");
- exit (1);
+ exit (EXIT_FAILURE);
}
/* Now close stdout and substitute /dev/null. This is necessary
@@ -265,7 +265,7 @@ rc_listen (void)
argv = realloc (call.args.args_val, (argc+1) * sizeof (char *));
if (argv == NULL) {
perror ("realloc");
- exit (1);
+ exit (EXIT_FAILURE);
}
call.args.args_val = argv;
argv[argc] = NULL;
@@ -290,7 +290,7 @@ rc_listen (void)
/* Exit on error? */
if (call.exit_on_error && reply.r == -1) {
unlink (sockpath);
- exit (1);
+ exit (EXIT_FAILURE);
}
}
@@ -302,7 +302,7 @@ rc_listen (void)
}
unlink (sockpath);
- exit (0);
+ exit (EXIT_SUCCESS);
}
/* Remote control client. */