/* Send signal to running daemon and the show resulting file. */ static void killshow(int signo, char *file) { pid_t pid = daemon_pid(); char buf[100]; if (pid > 0) { if (file) remove(file); kill(pid, signo); if (file) { int result; usleep(200); snprintf(buf, sizeof(buf), "cat %s", file); result = system(buf); } } }
/* Send signal to running daemon and the show resulting file. */ static void killshow(int signo, char *file) { pid_t pid = daemon_pid(); char buf[100]; if (pid > 0) { if (file) remove(file); kill(pid, signo); if (file) { usleep(200); snprintf(buf, sizeof(buf), "cat %s", file); if (-1 == system(buf)) { warnx("Failed listing file %s\n", file); } } } }
/* Send signal to running daemon and the show resulting file. */ static int killshow(int signo, char *file) { pid_t pid = daemon_pid(); char buf[100]; if (pid > 0) { if (file && -1 == remove(file) && errno != ENOENT) warn("Failed removing %s, may be showing stale information", file); kill(pid, signo); if (file) { usleep(200); snprintf(buf, sizeof(buf), "cat %s", file); if (-1 == system(buf)) { warnx("Failed listing file %s\n", file); } } } return 0; }