44 lines
1.1 KiB
Text
44 lines
1.1 KiB
Text
$NetBSD: patch-ac,v 1.1 2007/10/01 11:02:45 rillig Exp $
|
|
|
|
--- uucplock.c.orig 1999-12-02 03:58:31.000000000 +0100
|
|
+++ uucplock.c 2007-10-01 12:47:24.989964000 +0200
|
|
@@ -35,9 +35,13 @@
|
|
static char sccsid[] = "@(#)uucplock.c 5.5 (Berkeley) 6/1/90";
|
|
#endif /* not lint */
|
|
|
|
-#include <sys/file.h>
|
|
-#include <sys/dir.h>
|
|
+#include <dirent.h>
|
|
#include <errno.h>
|
|
+#include <fcntl.h>
|
|
+#include <signal.h>
|
|
+#include <stdio.h>
|
|
+#include <string.h>
|
|
+#include <unistd.h>
|
|
|
|
#include "pathnames.h"
|
|
|
|
@@ -47,13 +51,12 @@ static char sccsid[] = "@(#)uucplock.c 5
|
|
* -1 - failure
|
|
*/
|
|
|
|
+int
|
|
uu_lock(ttyname)
|
|
char *ttyname;
|
|
{
|
|
- extern int errno;
|
|
int fd, pid;
|
|
char tbuf[sizeof(_PATH_LOCKDIRNAME) + MAXNAMLEN];
|
|
- off_t lseek();
|
|
|
|
(void)snprintf(tbuf, sizeof(tbuf), _PATH_LOCKDIRNAME, ttyname);
|
|
fd = open(tbuf, O_RDWR|O_CREAT|O_EXCL, 0664);
|
|
@@ -81,7 +84,7 @@ uu_lock(ttyname)
|
|
* The process that locked the file isn't running, so
|
|
* we'll lock it ourselves
|
|
*/
|
|
- if (lseek(fd, 0L, L_SET) < 0) {
|
|
+ if (lseek(fd, 0L, SEEK_SET) < 0) {
|
|
(void)close(fd);
|
|
perror("lock lseek");
|
|
return(-1);
|