mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-04 08:55:06 -05:00
use return to exit from main function
This commit is contained in:
4
client.c
4
client.c
@@ -2729,11 +2729,11 @@ main(int argc, char **argv)
|
|||||||
family = IPADDR_INET6;
|
family = IPADDR_INET6;
|
||||||
} else if (!strcmp("-v", *argv) || !strcmp("--version",*argv)) {
|
} else if (!strcmp("-v", *argv) || !strcmp("--version",*argv)) {
|
||||||
printf("chronyc (chrony) version %s (%s)\n", CHRONY_VERSION, CHRONYC_FEATURES);
|
printf("chronyc (chrony) version %s (%s)\n", CHRONY_VERSION, CHRONYC_FEATURES);
|
||||||
exit(0);
|
return 0;
|
||||||
} else if (!strncmp(*argv, "-", 1)) {
|
} else if (!strncmp(*argv, "-", 1)) {
|
||||||
fprintf(stderr, "Usage: %s [-h HOST] [-p PORT] [-n] [-4|-6] [-a] [-f FILE] [-m] [COMMAND]\n",
|
fprintf(stderr, "Usage: %s [-h HOST] [-p PORT] [-n] [-4|-6] [-a] [-f FILE] [-m] [COMMAND]\n",
|
||||||
progname);
|
progname);
|
||||||
exit(1);
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
break; /* And process remainder of line as a command */
|
break; /* And process remainder of line as a command */
|
||||||
}
|
}
|
||||||
|
|||||||
6
main.c
6
main.c
@@ -387,7 +387,7 @@ int main
|
|||||||
} else if (!strcmp("-v", *argv) || !strcmp("--version",*argv)) {
|
} else if (!strcmp("-v", *argv) || !strcmp("--version",*argv)) {
|
||||||
/* This write to the terminal is OK, it comes before we turn into a daemon */
|
/* This write to the terminal is OK, it comes before we turn into a daemon */
|
||||||
printf("chronyd (chrony) version %s (%s)\n", CHRONY_VERSION, CHRONYD_FEATURES);
|
printf("chronyd (chrony) version %s (%s)\n", CHRONY_VERSION, CHRONYD_FEATURES);
|
||||||
exit(0);
|
return 0;
|
||||||
} else if (!strcmp("-n", *argv)) {
|
} else if (!strcmp("-n", *argv)) {
|
||||||
nofork = 1;
|
nofork = 1;
|
||||||
} else if (!strcmp("-d", *argv)) {
|
} else if (!strcmp("-d", *argv)) {
|
||||||
@@ -409,7 +409,7 @@ int main
|
|||||||
} else if (!strcmp("-h", *argv) || !strcmp("--help", *argv)) {
|
} else if (!strcmp("-h", *argv) || !strcmp("--help", *argv)) {
|
||||||
printf("Usage: %s [-4|-6] [-n|-d] [-q|-Q] [-r] [-R] [-s] [-f FILE|COMMAND...]\n",
|
printf("Usage: %s [-4|-6] [-n|-d] [-q|-Q] [-r] [-R] [-s] [-f FILE|COMMAND...]\n",
|
||||||
progname);
|
progname);
|
||||||
exit(0);
|
return 0;
|
||||||
} else if (*argv[0] == '-') {
|
} else if (*argv[0] == '-') {
|
||||||
LOG_FATAL(LOGF_Main, "Unrecognized command line option [%s]", *argv);
|
LOG_FATAL(LOGF_Main, "Unrecognized command line option [%s]", *argv);
|
||||||
} else {
|
} else {
|
||||||
@@ -422,7 +422,7 @@ int main
|
|||||||
if (getuid() != 0) {
|
if (getuid() != 0) {
|
||||||
/* This write to the terminal is OK, it comes before we turn into a daemon */
|
/* This write to the terminal is OK, it comes before we turn into a daemon */
|
||||||
fprintf(stderr,"Not superuser\n");
|
fprintf(stderr,"Not superuser\n");
|
||||||
exit(1);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Turn into a daemon */
|
/* Turn into a daemon */
|
||||||
|
|||||||
Reference in New Issue
Block a user