X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=daemon%2Fguestfsd.c;h=067c91659b79b6105d434ff162c7e9bc59c06f03;hb=1b4bab6db252abcc3daab11159b0e45862c10b4c;hp=9375ede2785481718f4067fe5db68eea0bee3a98;hpb=9c75b1554b5121a7d2b24b99badd1333769a9555;p=libguestfs.git diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c index 9375ede..067c916 100644 --- a/daemon/guestfsd.c +++ b/daemon/guestfsd.c @@ -27,15 +27,27 @@ #include #include #include -#include #include -#include #include -#include #include #include #include + +#ifdef HAVE_NETDB_H +#include +#endif + +#ifdef HAVE_SYS_SELECT_H +#include +#endif + +#ifdef HAVE_SYS_WAIT_H +#include +#endif + +#ifdef HAVE_PRINTF_H #include +#endif #include "c-ctype.h" #include "ignore-value.h" @@ -121,17 +133,17 @@ main (int argc, char *argv[]) case '?': usage (); - exit (0); + exit (EXIT_SUCCESS); default: fprintf (stderr, "guestfsd: unexpected command line option 0x%x\n", c); - exit (1); + exit (EXIT_FAILURE); } } if (optind < argc) { usage (); - exit (1); + exit (EXIT_FAILURE); } cmdline = read_cmdline (); @@ -190,7 +202,7 @@ main (int argc, char *argv[]) vmchannel = strndup (p + 18, len); if (!vmchannel) { perror ("strndup"); - exit (1); + exit (EXIT_FAILURE); } } @@ -204,7 +216,7 @@ main (int argc, char *argv[]) vmchannel = strndup (p + 4, len); if (!vmchannel) { perror ("strndup"); - exit (1); + exit (EXIT_FAILURE); } memcpy (vmchannel, "tcp:", 4); } @@ -216,7 +228,7 @@ main (int argc, char *argv[]) vmchannel = strdup ("tcp:" GUESTFWD_ADDR ":" GUESTFWD_PORT); if (!vmchannel) { perror ("strdup"); - exit (1); + exit (EXIT_FAILURE); } } @@ -241,7 +253,7 @@ main (int argc, char *argv[]) } else { fprintf (stderr, "vmchannel: expecting \"tcp::\": %s\n", vmchannel); - exit (1); + exit (EXIT_FAILURE); } memset (&hints, 0, sizeof hints); @@ -251,7 +263,7 @@ main (int argc, char *argv[]) if (r != 0) { fprintf (stderr, "%s:%s: %s\n", host, port, gai_strerror (r)); - exit (1); + exit (EXIT_FAILURE); } /* Connect to the given TCP socket. */ @@ -272,7 +284,7 @@ main (int argc, char *argv[]) "unknown vmchannel connection type: %s\n" "expecting \"tcp::\"\n", vmchannel); - exit (1); + exit (EXIT_FAILURE); } if (sock == -1) { @@ -291,7 +303,7 @@ main (int argc, char *argv[]) "or on the libguestfs redhat com mailing list.\n" "\n", vmchannel); - exit (1); + exit (EXIT_FAILURE); } /* Send the magic length message which indicates that @@ -304,7 +316,7 @@ main (int argc, char *argv[]) xdr_uint32_t (&xdr, &len); if (xwrite (sock, lenbuf, sizeof lenbuf) == -1) - exit (1); + exit (EXIT_FAILURE); xdr_destroy (&xdr); @@ -312,14 +324,14 @@ main (int argc, char *argv[]) if (!dont_fork) { if (daemon (0, 1) == -1) { perror ("daemon"); - exit (1); + exit (EXIT_FAILURE); } } /* Enter the main loop, reading and performing actions. */ main_loop (sock); - exit (0); + exit (EXIT_SUCCESS); } /* Read /proc/cmdline. */