diff options
Diffstat (limited to 'lib/libutil/uucplock.c')
-rw-r--r-- | lib/libutil/uucplock.c | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/lib/libutil/uucplock.c b/lib/libutil/uucplock.c index 7c584401d15..e7a471bb2e1 100644 --- a/lib/libutil/uucplock.c +++ b/lib/libutil/uucplock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uucplock.c,v 1.11 2003/06/02 20:18:42 millert Exp $ */ +/* $OpenBSD: uucplock.c,v 1.12 2004/05/28 07:03:48 deraadt Exp $ */ /* * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. @@ -61,22 +61,19 @@ static pid_t get_pid(int fd,int *err); /* * uucp style locking routines */ - int -uu_lock(ttyname) - const char *ttyname; +uu_lock(const char *ttyname) { - int fd, tmpfd, i; - pid_t pid, pid_old; char lckname[sizeof(_PATH_UUCPLOCK) + MAXNAMLEN], lcktmpname[sizeof(_PATH_UUCPLOCK) + MAXNAMLEN]; - int err, uuerr; + int fd, tmpfd, i, err, uuerr; + pid_t pid, pid_old; pid = getpid(); (void)snprintf(lcktmpname, sizeof(lcktmpname), _PATH_UUCPLOCK LOCKTMP, - (long)pid); + (long)pid); (void)snprintf(lckname, sizeof(lckname), _PATH_UUCPLOCK LOCKFMT, - ttyname); + ttyname); if ((tmpfd = creat(lcktmpname, 0664)) < 0) GORET(0, UU_LOCK_CREAT_ERR); @@ -126,12 +123,10 @@ ret0: } int -uu_lock_txfr(ttyname, pid) - const char *ttyname; - pid_t pid; +uu_lock_txfr(const char *ttyname, pid_t pid) { - int fd, err; char lckname[sizeof(_PATH_UUCPLOCK) + MAXNAMLEN]; + int fd, err; snprintf(lckname, sizeof(lckname), _PATH_UUCPLOCK LOCKFMT, ttyname); @@ -148,8 +143,7 @@ uu_lock_txfr(ttyname, pid) } int -uu_unlock(ttyname) - const char *ttyname; +uu_unlock(const char *ttyname) { char tbuf[sizeof(_PATH_UUCPLOCK) + MAXNAMLEN]; @@ -158,8 +152,7 @@ uu_unlock(ttyname) } const char * -uu_lockerr(uu_lockresult) - int uu_lockresult; +uu_lockerr(int uu_lockresult) { static char errbuf[128]; char *fmt; @@ -200,9 +193,7 @@ uu_lockerr(uu_lockresult) } static int -put_pid(fd, pid) - int fd; - pid_t pid; +put_pid(int fd, pid_t pid) { char buf[32]; int len; @@ -218,9 +209,7 @@ put_pid(fd, pid) } static pid_t -get_pid(fd, err) - int fd; - int *err; +get_pid(int fd, int *err) { int bytes_read; char buf[32]; |