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 <vap...@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.8.2

Reply via email to