]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/utils.c
make it compile under Solaris
[ppp.git] / pppd / utils.c
index bec5f89158c8bb6f265e5208b444d8e661cfc612..714a7c0b4e769f4281371b9df055cea0cc8b0cc1 100644 (file)
@@ -17,7 +17,7 @@
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 #ifndef lint
-static char rcsid[] = "$Id: utils.c,v 1.1 1999/04/12 06:24:53 paulus Exp $";
+static char rcsid[] = "$Id: utils.c,v 1.3 1999/05/04 06:58:36 paulus Exp $";
 #endif
 
 #include <stdio.h>
@@ -40,6 +40,9 @@ static char rcsid[] = "$Id: utils.c,v 1.1 1999/04/12 06:24:53 paulus Exp $";
 #include <sys/stat.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
+#ifdef SVR4
+#include <sys/sysmacros.h>
+#endif
 
 #include "pppd.h"
 
@@ -773,7 +776,9 @@ lock(char *dev)
        lock_buffer[n] = 0;
        pid = atoi(lock_buffer);
 #endif /* LOCK_BINARY */
-       if (pid == 0 || pid == getpid()
+       if (pid == getpid())
+           return 1;           /* somebody else locked it for us */
+       if (pid == 0
            || (kill(pid, 0) == -1 && errno == ESRCH)) {
            if (unlink (lock_file) == 0) {
                notice("Removed stale lock on %s (pid %d)", dev, pid);