mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06: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:
|
default:
|
||||||
fprintf (stderr, "libvirtd: internal error: unknown flag: %c\n",
|
fprintf (stderr, "libvirtd: internal error: unknown flag: %c\n",
|
||||||
c);
|
c);
|
||||||
exit (1);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -816,14 +816,14 @@ int main(int argc, char **argv) {
|
|||||||
persist = 1;
|
persist = 1;
|
||||||
} else {
|
} else {
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
exit(1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (geteuid() != 0) {
|
if (geteuid() != 0) {
|
||||||
fprintf(stderr, "%s must be run as root or suid\n", argv[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.
|
* failure.
|
||||||
*/
|
*/
|
||||||
if (proxyListenUnixSocket(PROXY_SOCKET_PATH) < 0)
|
if (proxyListenUnixSocket(PROXY_SOCKET_PATH) < 0)
|
||||||
exit(0);
|
exit(EXIT_SUCCESS);
|
||||||
if (proxyInitXen() == 0)
|
if (proxyInitXen() == 0)
|
||||||
proxyMainLoop();
|
proxyMainLoop();
|
||||||
sleep(1);
|
sleep(1);
|
||||||
proxyCloseUnixSocket();
|
proxyCloseUnixSocket();
|
||||||
exit(0);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* WITHOUT_XEN */
|
#else /* WITHOUT_XEN */
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
fprintf(stderr, "libvirt was compiled without Xen support\n");
|
fprintf(stderr, "libvirt was compiled without Xen support\n");
|
||||||
exit(1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* WITH_XEN */
|
#endif /* WITH_XEN */
|
||||||
|
@ -15,23 +15,23 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
fprintf(stderr, "Usage: %s conf_file\n", argv[0]);
|
fprintf(stderr, "Usage: %s conf_file\n", argv[0]);
|
||||||
exit(1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
conf = virConfReadFile(argv[1], 0);
|
conf = virConfReadFile(argv[1], 0);
|
||||||
if (conf == NULL) {
|
if (conf == NULL) {
|
||||||
fprintf(stderr, "Failed to process %s\n", argv[1]);
|
fprintf(stderr, "Failed to process %s\n", argv[1]);
|
||||||
exit(2);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
ret = virConfWriteMem(&buffer[0], &len, conf);
|
ret = virConfWriteMem(&buffer[0], &len, conf);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
fprintf(stderr, "Failed to serialize %s back\n", argv[1]);
|
fprintf(stderr, "Failed to serialize %s back\n", argv[1]);
|
||||||
exit(3);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
virConfFree(conf);
|
virConfFree(conf);
|
||||||
if (fwrite(buffer, 1, len, stdout) != len) {
|
if (fwrite(buffer, 1, len, stdout) != len) {
|
||||||
fprintf(stderr, "Write failed: %s\n", strerror (errno));
|
fprintf(stderr, "Write failed: %s\n", strerror (errno));
|
||||||
exit(1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
exit(0);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
static int
|
static int
|
||||||
mymain(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
|
mymain(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
exit (77); /* means 'test skipped' for automake */
|
exit (EXIT_AM_SKIP);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -232,6 +232,6 @@ VIRT_TEST_MAIN(mymain)
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
int main (void) { return (77); /* means 'test skipped' for automake */ }
|
int main (void) { return (EXIT_AM_SKIP); }
|
||||||
|
|
||||||
#endif /* WITH_QEMU */
|
#endif /* WITH_QEMU */
|
||||||
|
@ -146,6 +146,6 @@ VIRT_TEST_MAIN(mymain)
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
int main (void) { exit (77); /* means 'test skipped' to automake */ }
|
int main (void) { exit (EXIT_AM_SKIP); }
|
||||||
|
|
||||||
#endif /* WITH_QEMU */
|
#endif /* WITH_QEMU */
|
||||||
|
@ -24,12 +24,12 @@ int main(void) {
|
|||||||
}
|
}
|
||||||
if (conn == NULL) {
|
if (conn == NULL) {
|
||||||
fprintf(stderr, "First virConnectOpen() failed\n");
|
fprintf(stderr, "First virConnectOpen() failed\n");
|
||||||
exit(1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
dom = virDomainLookupByID(conn, id);
|
dom = virDomainLookupByID(conn, id);
|
||||||
if (dom == NULL) {
|
if (dom == NULL) {
|
||||||
fprintf(stderr, "First lookup for domain %d failed\n", id);
|
fprintf(stderr, "First lookup for domain %d failed\n", id);
|
||||||
exit(1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
virDomainFree(dom);
|
virDomainFree(dom);
|
||||||
virConnectClose(conn);
|
virConnectClose(conn);
|
||||||
@ -39,16 +39,16 @@ int main(void) {
|
|||||||
conn = virConnectOpen(NULL);
|
conn = virConnectOpen(NULL);
|
||||||
if (conn == NULL) {
|
if (conn == NULL) {
|
||||||
fprintf(stderr, "Second virConnectOpen() failed\n");
|
fprintf(stderr, "Second virConnectOpen() failed\n");
|
||||||
exit(1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
dom = virDomainLookupByID(conn, id);
|
dom = virDomainLookupByID(conn, id);
|
||||||
if (dom == NULL) {
|
if (dom == NULL) {
|
||||||
fprintf(stderr, "Second lookup for domain %d failed\n", id);
|
fprintf(stderr, "Second lookup for domain %d failed\n", id);
|
||||||
exit(1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
virDomainFree(dom);
|
virDomainFree(dom);
|
||||||
virConnectClose(conn);
|
virConnectClose(conn);
|
||||||
printf("OK\n");
|
printf("OK\n");
|
||||||
exit(0);
|
exit(EXIT_SUCCESS);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* utils.c: test utils
|
* 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
|
* See COPYING.LIB for the License of this software
|
||||||
*
|
*
|
||||||
@ -13,6 +13,8 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#define EXIT_AM_SKIP 77 /* tell Automake we're skipping a test */
|
||||||
|
|
||||||
double virtTestCountAverage(double *items,
|
double virtTestCountAverage(double *items,
|
||||||
int nitems);
|
int nitems);
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ mymain(int argc, char **argv)
|
|||||||
abs_srcdir = getcwd(cwd, sizeof(cwd));
|
abs_srcdir = getcwd(cwd, sizeof(cwd));
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
exit (77); /* means 'test skipped' for automake */
|
exit (EXIT_AM_SKIP);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
snprintf(buffer, PATH_MAX-1, "test://%s/../examples/xml/test/testnode.xml", abs_srcdir);
|
snprintf(buffer, PATH_MAX-1, "test://%s/../examples/xml/test/testnode.xml", abs_srcdir);
|
||||||
|
Loading…
Reference in New Issue
Block a user