(void) unlink(cleanup_pidfile);
if (cleanup_socket)
(void) unlink(cleanup_socket);
- exit(0);
+ exit(EXIT_SUCCESS);
}
static int call_daemon(const char *socket_path, int op, char *buf,
if (!quiet)
fprintf(stderr, _("Failed to open/create %s: %s\n"),
pidfile_path, strerror(errno));
- exit(1);
+ exit(EXIT_FAILURE);
}
cleanup_pidfile = pidfile_path;
cleanup_socket = 0;
if (!quiet)
fprintf(stderr, _("Failed to lock %s: %s\n"),
pidfile_path, strerror(errno));
- exit(1);
+ exit(EXIT_FAILURE);
}
ret = call_daemon(socket_path, 0, reply_buf, sizeof(reply_buf), 0, 0);
if (ret > 0) {
if (!quiet)
printf(_("uuidd daemon already running at pid %s\n"),
reply_buf);
- exit(1);
+ exit(EXIT_FAILURE);
}
alarm(0);
if (!quiet)
fprintf(stderr, _("Couldn't create unix stream "
"socket: %s"), strerror(errno));
- exit(1);
+ exit(EXIT_FAILURE);
}
/*
fprintf(stderr,
_("Couldn't bind unix socket %s: %s\n"),
socket_path, strerror(errno));
- exit(1);
+ exit(EXIT_FAILURE);
}
(void) umask(save_umask);
fprintf(stderr, _("Couldn't listen on unix "
"socket %s: %s\n"), socket_path,
strerror(errno));
- exit(1);
+ exit(EXIT_FAILURE);
}
cleanup_socket = socket_path;
num = strtol(optarg, &tmp, 0);
if ((num < 1) || *tmp) {
fprintf(stderr, _("Bad number: %s\n"), optarg);
- exit(1);
+ return EXIT_FAILURE;
}
case 'p':
pidfile_path = optarg;
timeout = strtol(optarg, &tmp, 0);
if ((timeout < 0) || *tmp) {
fprintf(stderr, _("Bad number: %s\n"), optarg);
- exit(EXIT_FAILURE);
+ return EXIT_FAILURE;
}
break;
case 'V':
if (ret < 0) {
printf(_("Error calling uuidd daemon (%s): %s\n"),
err_context, strerror(errno));
- exit(1);
+ return EXIT_FAILURE;
}
if (do_type == UUIDD_OP_TIME_UUID) {
if (ret != sizeof(uu) + sizeof(num))
printf("\t%s\n", str);
}
}
- exit(0);
+ return EXIT_SUCCESS;
}
if (do_type) {
ret = call_daemon(socket_path, do_type, (char *) &uu,
if (ret < 0) {
printf(_("Error calling uuidd daemon (%s): %s\n"),
err_context, strerror(errno));
- exit(1);
+ return EXIT_FAILURE;
}
if (ret != sizeof(uu)) {
unexpected_size:
printf(_("Unexpected reply length from server %d\n"),
ret);
- exit(1);
+ return EXIT_FAILURE;
}
uuid_unparse(uu, str);
printf("%s\n", str);
- exit(0);
+ return EXIT_SUCCESS;
}
if (do_kill) {
_("Couldn't kill uuidd running "
"at pid %d: %s\n"), do_kill,
strerror(errno));
- exit(1);
+ return EXIT_FAILURE;
}
if (!quiet)
printf(_("Killed uuidd running at pid %d\n"),
do_kill);
}
- exit(0);
+ return EXIT_SUCCESS;
}
server_loop(socket_path, pidfile_path, debug, timeout, quiet);
- return 0;
+ return EXIT_SUCCESS;
}