From ecbf047d3b505a6fe361a8f09a2a002822d4753b Mon Sep 17 00:00:00 2001 From: Brian Somers Date: Mon, 2 Oct 2000 17:32:00 +0000 Subject: [PATCH] Correct uu_lock_txfr. I don't think this ever worked correctly. --- lib/libutil/uucplock.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/libutil/uucplock.c b/lib/libutil/uucplock.c index 012016a3e7c1..a81d91a56ebc 100644 --- a/lib/libutil/uucplock.c +++ b/lib/libutil/uucplock.c @@ -139,13 +139,14 @@ uu_lock_txfr(const char *ttyname, pid_t pid) if ((fd = open(lckname, O_RDWR)) < 0) return UU_LOCK_OWNER_ERR; if (get_pid(fd, &err) != getpid()) - return UU_LOCK_OWNER_ERR; - lseek(fd, 0, SEEK_SET); - if (put_pid(fd, pid)) - return UU_LOCK_WRITE_ERR; + err = UU_LOCK_OWNER_ERR; + else { + lseek(fd, 0, SEEK_SET); + err = put_pid(fd, pid) ? 0 : UU_LOCK_WRITE_ERR; + } close(fd); - return UU_LOCK_OK; + return err; } int