aboutsummaryrefslogtreecommitdiff
path: root/src/exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/exec.c')
-rw-r--r--src/exec.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/exec.c b/src/exec.c
index c41d48c..5b75f77 100644
--- a/src/exec.c
+++ b/src/exec.c
@@ -31,7 +31,7 @@ start_prog(int argc, const char **argv, pid_t * ppid)
int i;
if (pipe(p)) {
- logmsg(LOG_CRIT, "pipe: %s", strerror(errno));
+ wy_log(LOG_CRIT, "pipe: %s", strerror(errno));
return NULL;
}
@@ -40,12 +40,12 @@ start_prog(int argc, const char **argv, pid_t * ppid)
/* Child process */
if (p[1] != 1 && dup2(p[1], 1) == -1) {
- logmsg(LOG_CRIT, "dup2: %s", strerror(errno));
+ wy_log(LOG_CRIT, "dup2: %s", strerror(errno));
_exit(EX_UNAVAILABLE);
}
if (p[1] != 1 && dup2(p[1], 2) == -1) {
- logmsg(LOG_CRIT, "dup2: %s", strerror(errno));
+ wy_log(LOG_CRIT, "dup2: %s", strerror(errno));
_exit(EX_UNAVAILABLE);
}
@@ -56,12 +56,12 @@ start_prog(int argc, const char **argv, pid_t * ppid)
close(i);
execvp(argv[0], (char **)argv);
- logmsg(LOG_CRIT, _("cannot run %s: %s"), argv[0],
+ wy_log(LOG_CRIT, _("cannot run %s: %s"), argv[0],
strerror(errno));
exit(EX_UNAVAILABLE);
case -1:
- logmsg(LOG_CRIT, _("cannot run `%s': fork failed: %s"),
+ wy_log(LOG_CRIT, _("cannot run `%s': fork failed: %s"),
argv[0], strerror(errno));
return NULL;
@@ -70,7 +70,7 @@ start_prog(int argc, const char **argv, pid_t * ppid)
close(p[1]);
fp = fdopen(p[0], "r");
if (!fp)
- logmsg(LOG_ERR, _("cannot fdopen: %s"),
+ wy_log(LOG_ERR, _("cannot fdopen: %s"),
strerror(errno));
*ppid = pid;
}
@@ -80,15 +80,15 @@ start_prog(int argc, const char **argv, pid_t * ppid)
/* Log everything read from FP as the output from the program PROG, using
syslog priority PRIO. */
void
-log_output(int prio, const char *prog, FILE * fp)
+log_output(int prio, const char *prog, FILE *fp)
{
size_t size = 0;
char *buf = NULL;
- logmsg(prio, _("%s output follows:"), prog);
+ wy_log(prio, _("%s output follows:"), prog);
while (grecs_getline(&buf, &size, fp) > 0)
- logmsg(prio, "%s", buf);
- logmsg(prio, _("end of %s output"), prog);
+ wy_log(prio, "%s", buf);
+ wy_log(prio, _("end of %s output"), prog);
free(buf);
}
@@ -104,7 +104,7 @@ wydawca_exec(int argc, const char **argv, int *retcode)
fp = start_prog(5, argv, &pid);
if (!fp) {
- logmsg(LOG_CRIT, _("cannot start %s"), argv[0]);
+ wy_log(LOG_CRIT, _("cannot start %s"), argv[0]);
return exec_error;
}
@@ -113,13 +113,13 @@ wydawca_exec(int argc, const char **argv, int *retcode)
switch (npid) {
case -1:
- logmsg(LOG_CRIT, _("cannot execute %s: waitpid failed: %s"),
+ wy_log(LOG_CRIT, _("cannot execute %s: waitpid failed: %s"),
argv[0], strerror(errno));
fclose(fp);
return exec_error;
case 0:
- logmsg(LOG_CRIT,
+ wy_log(LOG_CRIT,
_("cannot execute %s: the process did not respond "
"within 5 seconds: %s"), argv[0], strerror(errno));
kill(pid, SIGKILL);
@@ -134,7 +134,7 @@ wydawca_exec(int argc, const char **argv, int *retcode)
int rc = WEXITSTATUS(status);
if (rc) {
res = exec_fail;
- logmsg(LOG_ERR, _("command %s returned %d"), argv[0],
+ wy_log(LOG_ERR, _("command %s returned %d"), argv[0],
rc);
log_output(LOG_ERR, argv[0], fp);
} else {
@@ -147,13 +147,13 @@ wydawca_exec(int argc, const char **argv, int *retcode)
} else {
res = exec_error;
if (WIFSIGNALED(status))
- logmsg(LOG_ERR, _("%s terminated on signal %d"),
+ wy_log(LOG_ERR, _("%s terminated on signal %d"),
argv[0], WTERMSIG(status));
else if (WIFSTOPPED(status))
- logmsg(LOG_ERR, _("%s stopped on signal %d"),
+ wy_log(LOG_ERR, _("%s stopped on signal %d"),
argv[0], WTERMSIG(status));
else
- logmsg(LOG_ERR,
+ wy_log(LOG_ERR,
_("%s terminated with unrecognized status"),
argv[0]);
}

Return to:

Send suggestions and report system problems to the System administrator.