]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
avoid calling exit with a constant; use EXIT_* instead
authorJim Meyering <meyering@redhat.com>
Tue, 15 Dec 2009 08:43:29 +0000 (09:43 +0100)
committerJim Meyering <meyering@redhat.com>
Tue, 15 Dec 2009 16:46:04 +0000 (17:46 +0100)
This appeases a new gnulib-provided "syntax-check".
* daemon/libvirtd.c (main): Use EXIT_FAILURE, not 1.
* proxy/libvirt_proxy.c (main): Likewise, and EXIT_SUCCESS, not 0.
* tests/conftest.c (main): Likewise.
* tests/reconnect.c (main): Likewise.
* tests/testutils.h (EXIT_AM_SKIP): Define.
* tests/nodeinfotest.c (mymain): Use EXIT_AM_SKIP, not 77.
* tests/qemuargv2xmltest.c: Likewise.
* tests/qemuxml2xmltest.c: Likewise.
* tests/virshtest.c (mymain): Likewise.

daemon/libvirtd.c
proxy/libvirt_proxy.c
tests/conftest.c
tests/nodeinfotest.c
tests/qemuargv2xmltest.c
tests/qemuxml2xmltest.c
tests/reconnect.c
tests/testutils.h
tests/virshtest.c

index de6fc273ce000eeb127f39db3123ffcff396e77a..281a46a31e317a26bb6546a08cc9bb8fecd926aa 100644 (file)
@@ -3036,7 +3036,7 @@ int main(int argc, char **argv) {
         default:
             fprintf (stderr, "libvirtd: internal error: unknown flag: %c\n",
                      c);
-            exit (1);
+            exit (EXIT_FAILURE);
         }
     }
 
index e5298fd4be5e8ea2c031e9d069f4c1eab689f931..375966c1c41c143eff0758c987e22b5244856198 100644 (file)
@@ -816,14 +816,14 @@ int main(int argc, char **argv) {
              persist = 1;
          } else {
              usage(argv[0]);
-             exit(1);
+             exit(EXIT_FAILURE);
          }
     }
 
 
     if (geteuid() != 0) {
         fprintf(stderr, "%s must be run as root or suid\n", argv[0]);
-        /* exit(1); */
+        /* exit(EXIT_FAILURE); */
     }
 
     /*
@@ -838,19 +838,19 @@ int main(int argc, char **argv) {
      * failure.
      */
     if (proxyListenUnixSocket(PROXY_SOCKET_PATH) < 0)
-        exit(0);
+        exit(EXIT_SUCCESS);
     if (proxyInitXen() == 0)
         proxyMainLoop();
     sleep(1);
     proxyCloseUnixSocket();
-    exit(0);
+    exit(EXIT_SUCCESS);
 }
 
 #else /* WITHOUT_XEN */
 
 int main(void) {
     fprintf(stderr, "libvirt was compiled without Xen support\n");
-    exit(1);
+    exit(EXIT_FAILURE);
 }
 
 #endif /* WITH_XEN */
index d265de225a2e65dad00d458bea740062383ce890..a7977bb81a3a2f96c6fc1ee8aff03e54e59bf494 100644 (file)
@@ -15,23 +15,23 @@ int main(int argc, char **argv) {
 
     if (argc != 2) {
         fprintf(stderr, "Usage: %s conf_file\n", argv[0]);
-        exit(1);
+        exit(EXIT_FAILURE);
     }
 
     conf = virConfReadFile(argv[1], 0);
     if (conf == NULL) {
         fprintf(stderr, "Failed to process %s\n", argv[1]);
-        exit(2);
+        exit(EXIT_FAILURE);
     }
     ret = virConfWriteMem(&buffer[0], &len, conf);
     if (ret < 0) {
         fprintf(stderr, "Failed to serialize %s back\n", argv[1]);
-        exit(3);
+        exit(EXIT_FAILURE);
     }
     virConfFree(conf);
     if (fwrite(buffer, 1, len, stdout) != len) {
         fprintf(stderr, "Write failed: %s\n", strerror (errno));
-        exit(1);
+        exit(EXIT_FAILURE);
     }
-    exit(0);
+    exit(EXIT_SUCCESS);
 }
index 608a056dde5685651e7b7c30a8421d9ae3b954d0..4cb248acfbbc11a96f37bb5901562b9d76ed8fb1 100644 (file)
@@ -15,7 +15,7 @@
 static int
 mymain(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
 {
-    exit (77); /* means 'test skipped' for automake */
+    exit (EXIT_AM_SKIP);
 }
 
 #else
index 5602df0414f4149a7eafb08154b62428d286c51f..7f62baccc0d87a08009aa76f067ce432447cf24f 100644 (file)
@@ -232,6 +232,6 @@ VIRT_TEST_MAIN(mymain)
 
 #else
 
-int main (void) { return (77); /* means 'test skipped' for automake */ }
+int main (void) { return (EXIT_AM_SKIP); }
 
 #endif /* WITH_QEMU */
index 793900c8e3ab99f965364f3c2b8d74cedd212491..e5900a2c7473155552e597a63beb4de3f6dd4029 100644 (file)
@@ -146,6 +146,6 @@ VIRT_TEST_MAIN(mymain)
 
 #else
 
-int main (void) { exit (77); /* means 'test skipped' to automake */ }
+int main (void) { exit (EXIT_AM_SKIP); }
 
 #endif /* WITH_QEMU */
index 33af2cc8d902a9d76be31c7c78e1666676ffb2ed..63877fc6b6994cfeef5cf6d615e3f533bb9e5d12 100644 (file)
@@ -24,12 +24,12 @@ int main(void) {
     }
     if (conn == NULL) {
         fprintf(stderr, "First virConnectOpen() failed\n");
-        exit(1);
+        exit(EXIT_FAILURE);
     }
     dom = virDomainLookupByID(conn, id);
     if (dom == NULL) {
         fprintf(stderr, "First lookup for domain %d failed\n", id);
-        exit(1);
+        exit(EXIT_FAILURE);
     }
     virDomainFree(dom);
     virConnectClose(conn);
@@ -39,16 +39,16 @@ int main(void) {
         conn = virConnectOpen(NULL);
     if (conn == NULL) {
         fprintf(stderr, "Second virConnectOpen() failed\n");
-        exit(1);
+        exit(EXIT_FAILURE);
     }
     dom = virDomainLookupByID(conn, id);
     if (dom == NULL) {
         fprintf(stderr, "Second lookup for domain %d failed\n", id);
-        exit(1);
+        exit(EXIT_FAILURE);
     }
     virDomainFree(dom);
     virConnectClose(conn);
     printf("OK\n");
-    exit(0);
+    exit(EXIT_SUCCESS);
 
 }
index aef11795e87b94610b427a445ec36cb47d5e2dc8..e5d57504e387252276045d19245133e3f2316b1d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * utils.c: test utils
  *
- * Copyright (C) 2005, 2008 Red Hat, Inc.
+ * Copyright (C) 2005, 2008-2009 Red Hat, Inc.
  *
  * See COPYING.LIB for the License of this software
  *
@@ -13,6 +13,8 @@
 
 #include <stdio.h>
 
+#define EXIT_AM_SKIP 77 /* tell Automake we're skipping a test */
+
 double virtTestCountAverage(double *items,
                             int nitems);
 
index ef760e2e12f8dd09f6186f365552d54368f4a08f..ad3e2fc79fba2f67ea1e704d2922c54305068873 100644 (file)
@@ -231,7 +231,7 @@ mymain(int argc, char **argv)
         abs_srcdir = getcwd(cwd, sizeof(cwd));
 
 #ifdef WIN32
-    exit (77); /* means 'test skipped' for automake */
+    exit (EXIT_AM_SKIP);
 #endif
 
     snprintf(buffer, PATH_MAX-1, "test://%s/../examples/xml/test/testnode.xml", abs_srcdir);