forked from Lainports/freebsd-ports
It can be used to write mail messages to a qmail-style maildir, or to write data to a "spool" directory reliably.
45 lines
950 B
Text
45 lines
950 B
Text
--- 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 .
|