aboutsummaryrefslogtreecommitdiff
path: root/libexec/ftpd
diff options
context:
space:
mode:
authorYaroslav Tykhiy <ytykhiy@gmail.com>2005-01-10 12:19:11 +0000
committerYaroslav Tykhiy <ytykhiy@gmail.com>2005-01-10 12:19:11 +0000
commit1850cfa1c502f0681982f0a31f6658dff361ffc1 (patch)
tree5d68b578715ddcc8270ed5bebb4463f91b61d9b1 /libexec/ftpd
parent60c658a7ffb7db6e9ff42297679153d0b565b3ad (diff)
downloadsrc-1850cfa1c502f0681982f0a31f6658dff361ffc1.tar.gz
src-1850cfa1c502f0681982f0a31f6658dff361ffc1.zip
Replace err(3) calls when in daemon mode by syslog(3), too.
A daemon has no stderr to send its complains to. Pointed out by: Nick Leuta MFC after: 1 week
Notes
Notes: svn path=/head/; revision=139981
Diffstat (limited to 'libexec/ftpd')
-rw-r--r--libexec/ftpd/ftpd.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
index 10f70d53cbec..62257e8ca7a5 100644
--- a/libexec/ftpd/ftpd.c
+++ b/libexec/ftpd/ftpd.c
@@ -453,14 +453,18 @@ main(int argc, char *argv[], char **envp)
| O_NONBLOCK | O_EXLOCK, 0644);
if (fd < 0) {
if (errno == EAGAIN)
- errx(1, "%s: file locked", pid_file);
+ syslog(LOG_ERR,
+ "%s: already locked", pid_file);
else
- err(1, "%s", pid_file);
+ syslog(LOG_ERR, "%s: %m", pid_file);
+ exit(1);
}
snprintf(buf, sizeof(buf),
"%lu\n", (unsigned long) getpid());
- if (write(fd, buf, strlen(buf)) < 0)
- err(1, "%s: write", pid_file);
+ if (write(fd, buf, strlen(buf)) < 0) {
+ syslog(LOG_ERR, "%s: write: %m", pid_file);
+ exit(1);
+ }
/* Leave the pid file open and locked */
}
/*