summaryrefslogtreecommitdiffstats
path: root/lib/libutil/uucplock.c
diff options
context:
space:
mode:
authorbrian <brian@openbsd.org>1999-03-16 01:26:02 +0000
committerbrian <brian@openbsd.org>1999-03-16 01:26:02 +0000
commitcd1720ec7b5fc3c501c33303797cbc7c08341fdf (patch)
treeff2f06d12b5720396aefe7eb3eb19438637d9d1f /lib/libutil/uucplock.c
parentDetect pred1 packets where the length != the packet length (diff)
downloadwireguard-openbsd-cd1720ec7b5fc3c501c33303797cbc7c08341fdf.tar.xz
wireguard-openbsd-cd1720ec7b5fc3c501c33303797cbc7c08341fdf.zip
Get the pid right if a stale lock file exists.
Submitted by: Lawrence D. Lopez <lopez@cisco.com>
Diffstat (limited to 'lib/libutil/uucplock.c')
-rw-r--r--lib/libutil/uucplock.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libutil/uucplock.c b/lib/libutil/uucplock.c
index b88c7aab33f..4fa41288c0e 100644
--- a/lib/libutil/uucplock.c
+++ b/lib/libutil/uucplock.c
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: uucplock.c,v 1.4 1998/06/10 00:16:19 brian Exp $
+ * $Id: uucplock.c,v 1.5 1999/03/16 01:26:02 brian Exp $
*
*/
@@ -71,7 +71,7 @@ uu_lock(ttyname)
const char *ttyname;
{
int fd, tmpfd, i;
- pid_t pid;
+ pid_t pid, pid_old;
char lckname[sizeof(_PATH_UUCPLOCK) + MAXNAMLEN],
lcktmpname[sizeof(_PATH_UUCPLOCK) + MAXNAMLEN];
int err, uuerr;
@@ -96,12 +96,12 @@ uu_lock(ttyname)
if ((fd = open(lckname, O_RDONLY)) < 0)
GORET(1, UU_LOCK_OPEN_ERR);
- if ((pid = get_pid (fd, &err)) == -1)
+ if ((pid_old = get_pid (fd, &err)) == -1)
GORET(2, UU_LOCK_READ_ERR);
close(fd);
- if (kill(pid, 0) == 0 || errno != ESRCH)
+ if (kill(pid_old, 0) == 0 || errno != ESRCH)
GORET(1, UU_LOCK_INUSE);
/*
* The process that locked the file isn't running, so