summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2001-12-01 23:27:25 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2001-12-01 23:27:25 +0000
commitb11bbb51235bd85172226ea037257b53ee9402da (patch)
treef6118a5419bc82550325ed0df2f3e50047f6ffbb /libexec
parentea7f37b365f29a8552fe175609d79d58051b87c4 (diff)
Use pidfile() instead of doing the equivalent thing by hand, and sometimes
forgetting to unlink the pid file at exit. ok millert@ deraadt@
Diffstat (limited to 'libexec')
-rw-r--r--libexec/ftpd/Makefile5
-rw-r--r--libexec/ftpd/ftpd.c13
-rw-r--r--libexec/ftpd/pathnames.h3
3 files changed, 9 insertions, 12 deletions
diff --git a/libexec/ftpd/Makefile b/libexec/ftpd/Makefile
index 91a45ad5ed9..a78053d0b4b 100644
--- a/libexec/ftpd/Makefile
+++ b/libexec/ftpd/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.19 2001/05/29 21:35:16 millert Exp $
+# $OpenBSD: Makefile,v 1.20 2001/12/01 23:27:19 miod Exp $
# $NetBSD: Makefile,v 1.13 1996/02/16 02:07:41 cgd Exp $
# @(#)Makefile 8.2 (Berkeley) 4/4/94
@@ -20,6 +20,9 @@ CFLAGS += -I${LSDIR}
# not really used
CPPFLAGS+=-DINET6
+LDADD+= -lutil
+DPADD+= ${LIBUTIL}
+
.if (${TCP_WRAPPERS:L} == "yes")
CFLAGS+=-DTCPWRAPPERS
LDADD+= -lwrap
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
index 9837313aeb9..0d031c2800c 100644
--- a/libexec/ftpd/ftpd.c
+++ b/libexec/ftpd/ftpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ftpd.c,v 1.107 2001/11/17 19:54:56 deraadt Exp $ */
+/* $OpenBSD: ftpd.c,v 1.108 2001/12/01 23:27:20 miod Exp $ */
/* $NetBSD: ftpd.c,v 1.15 1995/06/03 22:46:47 mycroft Exp $ */
/*
@@ -73,7 +73,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)ftpd.c 8.4 (Berkeley) 4/16/94";
#else
-static char rcsid[] = "$OpenBSD: ftpd.c,v 1.107 2001/11/17 19:54:56 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: ftpd.c,v 1.108 2001/12/01 23:27:20 miod Exp $";
#endif
#endif /* not lint */
@@ -443,13 +443,8 @@ main(argc, argv, envp)
exit(1);
}
/* Stash pid in pidfile */
- if ((fp = fopen(_PATH_FTPDPID, "w")) == NULL)
- syslog(LOG_ERR, "can't open %s: %m", _PATH_FTPDPID);
- else {
- fprintf(fp, "%d\n", getpid());
- fchmod(fileno(fp), S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
- fclose(fp);
- }
+ if (pidfile(NULL))
+ syslog(LOG_ERR, "can't open pidfile: %m");
/*
* Loop forever accepting connection requests and forking off
* children to handle them.
diff --git a/libexec/ftpd/pathnames.h b/libexec/ftpd/pathnames.h
index 52ac8469df4..18a5451db40 100644
--- a/libexec/ftpd/pathnames.h
+++ b/libexec/ftpd/pathnames.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pathnames.h,v 1.4 1999/12/03 01:22:46 millert Exp $ */
+/* $OpenBSD: pathnames.h,v 1.5 2001/12/01 23:27:20 miod Exp $ */
/* $NetBSD: pathnames.h,v 1.5 1995/04/11 02:44:59 cgd Exp $ */
/*
@@ -43,5 +43,4 @@
#define _PATH_FTPWELCOME "/etc/ftpwelcome"
#define _PATH_FTPLOGINMESG "/etc/motd"
#define _PATH_FTPDSTATFILE "/var/log/ftpd"
-#define _PATH_FTPDPID "/var/run/ftpd.pid"
#define _PATH_CWDMESG ".message"