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
|
--- safecat.1 2000/11/21 08:57:15 1.1.1.1
+++ safecat.1 2000/11/21 10:25:44 1.2
@@ -80,9 +80,9 @@
and
.IR destdir ,
and exits unless both directories exist and are writable.
-Second, it
-.B stat()s
-the name
+Second, it attempts to
+.B open()
+exclusively the file
.BR tempdir/\fItime.pid.host ,
where
.I time
@@ -91,22 +91,21 @@
is the program's process ID,
and
.I host
-is the host name.
+is the host name. The exclusive
+.B open()
+will fail if the file already exists.
Third, if
-.B stat()
-returned anything other than ENOENT,
+.B open()
+returned EEXIST (the file already exists),
the program sleeps for two seconds, updates
.IR time ,
and tries the
-.B stat()
+.B open()
again, a limited number of times.
Fourth, the program
-creates
-.BR tempdir/\fItime.pid.host .
-Fifth, the program
.I NFS-writes
the message to the file.
-Sixth, the program
+Fifth, the program
.BR link() s
the file to
.BR destdir/\fItime.pid.host .
|