summaryrefslogtreecommitdiffstats
path: root/lib/libutil/uucplock.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2000-10-02 17:32:00 +0000
committerbrian <brian@FreeBSD.org>2000-10-02 17:32:00 +0000
commiteffa2801c61cd844177ae8f8b75b763d14bfea72 (patch)
tree45dff79bbcf81d866e604f58e283709d9d9d2f14 /lib/libutil/uucplock.c
parentd4edaae88f77cb78f7e0d294fef285db9617bd9c (diff)
downloadFreeBSD-src-effa2801c61cd844177ae8f8b75b763d14bfea72.zip
FreeBSD-src-effa2801c61cd844177ae8f8b75b763d14bfea72.tar.gz
Correct uu_lock_txfr. I don't think this ever worked correctly.
Diffstat (limited to 'lib/libutil/uucplock.c')
-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