diff options
author | brian <brian@FreeBSD.org> | 1999-03-11 09:09:20 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1999-03-11 09:09:20 +0000 |
commit | e4c4c7a0ff6824de6ba899ab305a47c726a135bb (patch) | |
tree | efebfe7584beb8fd4b07006646f089f5950d3cec /lib/libutil | |
parent | e1bfa8246d0e06905f031d831a39c068717a807f (diff) | |
download | FreeBSD-src-e4c4c7a0ff6824de6ba899ab305a47c726a135bb.zip FreeBSD-src-e4c4c7a0ff6824de6ba899ab305a47c726a135bb.tar.gz |
Get the pid right if a stale lock file exists.
PR: 10531
Submitted by: Lawrence D. Lopez <lopez@cisco.com>
Diffstat (limited to 'lib/libutil')
-rw-r--r-- | lib/libutil/uucplock.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libutil/uucplock.c b/lib/libutil/uucplock.c index 93c597e..f6b303f 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.9 1998/05/28 23:17:09 brian Exp $ + * $Id: uucplock.c,v 1.10 1998/06/10 00:16:28 brian Exp $ * */ @@ -70,7 +70,7 @@ int uu_lock(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; @@ -95,12 +95,12 @@ uu_lock(const char *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 |