| @@ -1,38 +1,44 @@ | | | @@ -1,38 +1,44 @@ |
1 | $NetBSD: patch-aa,v 1.1 2005/12/18 23:32:49 joerg Exp $ | | 1 | $NetBSD: patch-aa,v 1.2 2012/03/01 19:44:42 hans Exp $ |
2 | | | 2 | |
3 | --- ../src/uucplock.c.orig 2005-12-18 23:25:20.000000000 +0000 | | 3 | --- ../src/uucplock.c.orig 2005-12-18 23:25:20.000000000 +0000 |
4 | +++ ../src/uucplock.c | | 4 | +++ ../src/uucplock.c |
5 | @@ -40,6 +40,7 @@ static char sccsid[] = "@(#)uucplock.c 5 | | 5 | @@ -38,8 +38,12 @@ static char sccsid[] = "@(#)uucplock.c 5 |
| | | 6 | #include "config.h" |
| | | 7 | |
6 | #include <sys/file.h> | | 8 | #include <sys/file.h> |
7 | #include <sys/dir.h> | | 9 | -#include <sys/dir.h> |
| | | 10 | +#include <dirent.h> |
8 | #include <errno.h> | | 11 | #include <errno.h> |
9 | +#include <limits.h> | | 12 | +#include <limits.h> |
| | | 13 | +#include <sys/types.h> |
| | | 14 | +#include <sys/stat.h> |
| | | 15 | +#include <fcntl.h> |
10 | | | 16 | |
11 | #include "pathnames.h" | | 17 | #include "pathnames.h" |
12 | | | 18 | |
13 | @@ -52,9 +53,12 @@ static char sccsid[] = "@(#)uucplock.c 5 | | 19 | @@ -52,9 +56,12 @@ static char sccsid[] = "@(#)uucplock.c 5 |
14 | uu_lock(ttyname) | | 20 | uu_lock(ttyname) |
15 | char *ttyname; | | 21 | char *ttyname; |
16 | { | | 22 | { |
17 | - extern int errno; | | 23 | - extern int errno; |
18 | int fd, pid; | | 24 | int fd, pid; |
19 | +#ifdef NAME_MAX | | 25 | +#ifdef NAME_MAX |
20 | + char tbuf[sizeof(_PATH_LOCKDIRNAME) + NAME_MAX]; | | 26 | + char tbuf[sizeof(_PATH_LOCKDIRNAME) + NAME_MAX]; |
21 | +#else | | 27 | +#else |
22 | char tbuf[sizeof(_PATH_LOCKDIRNAME) + MAXNAMLEN]; | | 28 | char tbuf[sizeof(_PATH_LOCKDIRNAME) + MAXNAMLEN]; |
23 | +#endif | | 29 | +#endif |
24 | off_t lseek(); | | 30 | off_t lseek(); |
25 | | | 31 | |
26 | (void)snprintf(tbuf, sizeof(tbuf), _PATH_LOCKDIRNAME, ttyname); | | 32 | (void)snprintf(tbuf, sizeof(tbuf), _PATH_LOCKDIRNAME, ttyname); |
27 | @@ -104,7 +108,11 @@ uu_lock(ttyname) | | 33 | @@ -104,7 +111,11 @@ uu_lock(ttyname) |
28 | uu_unlock(ttyname) | | 34 | uu_unlock(ttyname) |
29 | char *ttyname; | | 35 | char *ttyname; |
30 | { | | 36 | { |
31 | +#ifdef NAME_MAX | | 37 | +#ifdef NAME_MAX |
32 | + char tbuf[sizeof(_PATH_LOCKDIRNAME) + NAME_MAX]; | | 38 | + char tbuf[sizeof(_PATH_LOCKDIRNAME) + NAME_MAX]; |
33 | +#else | | 39 | +#else |
34 | char tbuf[sizeof(_PATH_LOCKDIRNAME) + MAXNAMLEN]; | | 40 | char tbuf[sizeof(_PATH_LOCKDIRNAME) + MAXNAMLEN]; |
35 | +#endif | | 41 | +#endif |
36 | | | 42 | |
37 | (void)snprintf(tbuf, sizeof(tbuf), _PATH_LOCKDIRNAME, ttyname); | | 43 | (void)snprintf(tbuf, sizeof(tbuf), _PATH_LOCKDIRNAME, ttyname); |
38 | return(unlink(tbuf)); | | 44 | return(unlink(tbuf)); |