--- pwcheck/pwcheck.c.orig	Thu Aug 26 11:22:43 1999
+++ pwcheck/pwcheck.c	Fri Oct 29 21:41:17 1999
@@ -29,6 +29,14 @@
 #include <sys/un.h>
 #include <sys/uio.h>
 #include <sys/stat.h>
+#include <paths.h>
+#include <unistd.h>
+#include <syslog.h>
+#include "../config.h"
+
+#if !defined(_PATH_PWCHECKPID)
+# define _PATH_PWCHECKPID  _PATH_VARRUN "pwcheck.pid"
+#endif
 
 #include <config.h>
 
@@ -49,6 +57,21 @@
     int r;
     int len;
     mode_t oldumask;
+    char *pid_file = _PATH_PWCHECKPID;
+    FILE *fp;
+    pid_t pid;
+
+    /*
+     *   Record process ID - shamelessly stolen from inetd (I.V.)
+     */
+    pid = getpid();
+    fp = fopen(pid_file, "w");
+    if (fp) {
+        fprintf(fp, "%ld\n", (long)pid);
+        fclose(fp);
+    } else {
+        syslog(LOG_WARNING, "%s: %m", pid_file);
+    }
 
     s = socket(AF_UNIX, SOCK_STREAM, 0);
     if (s == -1) {
