1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
--- - 2003-02-15 23:35:46.000000000 +0800
+++ locking.c 2003-02-15 23:19:11.000000000 +0800
@@ -45,6 +45,7 @@
#include <stdarg.h>
#include "pathnames.h"
#include "mail.local.h"
+#include "open_with_exlock.h"
static char lpath[MAXPATHLEN];
@@ -93,7 +94,7 @@
}
goto again;
}
- if ((lfd = open(lpath, O_CREAT|O_WRONLY|O_EXCL|O_EXLOCK,
+ if ((lfd = open_with_exlock(lpath, O_CREAT|O_WRONLY|O_EXCL,
S_IRUSR|S_IWUSR)) != -1)
break;
again:
@@ -104,7 +105,7 @@
return(-1);
}
if (tries > 9 &&
- (lfd = open(lpath, O_WRONLY|O_EXLOCK, 0)) != -1) {
+ (lfd = open_with_exlock(lpath, O_WRONLY, 0)) != -1) {
if (fstat(lfd, &fsb) != -1 &&
lstat(lpath, &sb) != -1) {
if (fsb.st_dev == sb.st_dev &&
@@ -169,3 +170,4 @@
if (isfatal)
exit(1);
}
+
--- - 2003-02-15 23:37:13.000000000 +0800
+++ mail.local.c 2003-02-15 23:20:50.000000000 +0800
@@ -66,6 +66,7 @@
#include <string.h>
#include "pathnames.h"
#include "mail.local.h"
+#include "open_with_exlock.h"
int
main(int argc, char *argv[])
@@ -218,7 +219,7 @@
merr(NOTFATAL, "%s: %s", path, strerror(errno));
goto bad;
}
- if ((mbfd = open(path, O_APPEND|O_CREAT|O_EXCL|O_WRONLY|O_EXLOCK,
+ if ((mbfd = open_with_exlock(path, O_APPEND|O_CREAT|O_EXCL|O_WRONLY,
S_IRUSR|S_IWUSR)) < 0) {
if (errno == EEXIST) {
/* file appeared since lstat */
@@ -244,7 +245,7 @@
merr(NOTFATAL, "%s: linked or special file", path);
goto bad;
}
- if ((mbfd = open(path, O_APPEND|O_WRONLY|O_EXLOCK,
+ if ((mbfd = open_with_exlock(path, O_APPEND|O_WRONLY,
S_IRUSR|S_IWUSR)) < 0) {
merr(NOTFATAL, "%s: %s", path, strerror(errno));
goto bad;
@@ -340,3 +341,4 @@
{
merr(FATAL, "usage: mail.local [-lL] [-f from] user ...");
}
+
|