mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
avoid calling exit with a constant; use EXIT_* instead
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.
This commit is contained in:
parent
e7c8ab8f0e
commit
2e5efc3d6e
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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);
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user