Exemplo n.º 1
0
Arquivo: main.c Projeto: tzuryby/pimd
/* 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);
	}
    }
}
Exemplo n.º 2
0
/* 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);
	    }
	}
    }
}
Exemplo n.º 3
0
/* 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;
}