Index: MCONFIG.in --- MCONFIG.in.orig 2011-06-23 01:32:56.000000000 +0200 +++ MCONFIG.in 2011-06-24 20:54:05.000000000 +0200 @@ -21,6 +21,7 @@ # Prefixes prefix = @prefix@ exec_prefix = @exec_prefix@ +datarootdir = @datarootdir@ # Directory for user binaries BINDIR = @bindir@ Index: Makefile --- Makefile.orig 2011-06-23 01:32:56.000000000 +0200 +++ Makefile 2011-06-24 20:54:05.000000000 +0200 @@ -59,9 +59,9 @@ # Adding "configure" to the dependencies serializes this with running # autoconf, because there are apparently race conditions between # autoconf and autoheader. -aconfig.h.in: configure.in configure aclocal.m4 - rm -f aconfig.h.in aconfig.h - autoheader +#aconfig.h.in: configure.in configure aclocal.m4 +# rm -f aconfig.h.in aconfig.h +# autoheader configure: configure.in aclocal.m4 rm -rf MCONFIG configure config.log aconfig.h *.cache Index: tftpd/tftpd.c --- tftpd/tftpd.c.orig 2011-06-23 01:32:56.000000000 +0200 +++ tftpd/tftpd.c 2011-06-24 20:54:05.000000000 +0200 @@ -33,6 +33,9 @@ * SUCH DAMAGE. */ +#if defined(__NetBSD__) +#define _NETBSD_SOURCE +#endif #include "config.h" /* Must be included first */ #include "tftpd.h" @@ -767,6 +770,22 @@ #ifndef __CYGWIN__ set_socket_nonblock(fd, 1); #endif +#ifdef PID_FILE + /* Write PID file */ + { + mode_t old_umask; + pid_t pid; + FILE *fp; + + old_umask = umask((mode_t) 0022); + pid = getpid(); + if ((fp = fopen(PID_FILE, "w")) == NULL) + syslog(LOG_ERR, "cannot write PID file '%s'", PID_FILE); + fprintf(fp, "%ld\n", (long)pid); + fclose(fp); + umask(old_umask); + } +#endif } /* Disable path MTU discovery */