blob: ad34f3b5f6467b3be9d3999bcdc79ca9ff8c754b [file] [log] [blame]
From e88ed3752872d7c7ca37d95eb4d434ca4d3c4eae Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Sat, 19 Apr 2014 10:39:39 -0400
Subject: [PATCH iputils] tftpd: fix syslog setup
Commit d81a44625b04d487c895473aa77af13420b7afdd added support for checking
the set*id calls, but would call syslog() before it had called openlog().
Move the call up earlier to fix that.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
tftpd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tftpd.c b/tftpd.c
index e3af2f4..7ddc8eb 100644
--- a/tftpd.c
+++ b/tftpd.c
@@ -109,6 +109,8 @@ int main(int ac, char **av)
register int n = 0;
int on = 1;
+ openlog("tftpd", LOG_PID, LOG_DAEMON);
+
/* Sanity. If parent forgot to setuid() on us. */
if (geteuid() == 0) {
if (setgid(65534)) {
@@ -125,7 +127,6 @@ int main(int ac, char **av)
while (ac-- > 0 && n < MAXARG)
dirs[n++] = *av++;
- openlog("tftpd", LOG_PID, LOG_DAEMON);
if (ioctl(0, FIONBIO, &on) < 0) {
syslog(LOG_ERR, "ioctl(FIONBIO): %m\n");
exit(1);
--
2.3.5