static int do_accept(const char* name, char **argv, char **envp, int fd) {
_cleanup_free_ char *local = NULL, *peer = NULL;
- int fd2;
+ _cleanup_close_ int fd2 = -1;
fd2 = accept(fd, NULL, NULL);
if (fd2 < 0) {
return r;
}
-static int help(void) {
+static void help(void) {
printf("%s [OPTIONS...]\n\n"
"Listen on sockets and launch child on connection.\n\n"
"Options:\n"
" --version Print version string and exit\n"
"\n"
"Note: file descriptors from sd_listen_fds() will be passed through.\n"
- , program_invocation_short_name
- );
-
- return 0;
+ , program_invocation_short_name);
}
static int parse_argv(int argc, char *argv[]) {
while ((c = getopt_long(argc, argv, "+hl:aE:", options, NULL)) >= 0)
switch(c) {
case 'h':
- return help();
+ help();
+ return 0;
case ARG_VERSION:
puts(PACKAGE_STRING);
}
if (optind == argc) {
- log_error("Usage: %s [OPTION...] PROGRAM [OPTION...]",
+ log_error("%s: command to execute is missing.",
program_invocation_short_name);
return -EINVAL;
}