summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/libutil/uucplock.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/libutil/uucplock.c b/lib/libutil/uucplock.c
index 012016a..a81d91a 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
OpenPOWER on IntegriCloud