HylaFAX The world's
most advanced open source fax server
|
|
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
posix-rename.patch for FaxRequest.c++
I have had this patch on my production server for a couple months now, so
I am sure it works as expected.
The problem it fixes, is that if you send a fax to multiple destinations,
hylafax leaves files in the docq directory which never get cleaned out.
The reason is that hylafax _thinks_ it removes the files by renaming them
to a base document, but really it doesn't. POSIX specifies that if
source and destination files of a rename command are hard-linked together
(which they are in this case), rename should do nothing but return
success.
So the solution is to rename the file (which actually does rename it the
first time and thus creates the base document), and then unlink the file.
The unlink will fail the first time because the file is not there (but who
cares; we ignore the return code), and succeed on subsequent documents,
because rename left the file there.
Here is the patch for your perusal. I hope this can be applied to the
source code in time for the upcoming release.
~ John Williams
--- FaxRequest.c++ 1999/08/17 20:22:17 1.1
+++ FaxRequest.c++ 1999/08/17 20:24:10
@@ -506,8 +506,10 @@
if (Sys::rename(src.item, basedoc) < 0) {
logError("Unable to rename transmitted document %s: %s",
(const char*) src.item, strerror(errno));
- Sys::unlink(src.item); // just remove it (???XXX)
}
+ // Posix rename will succeed without doing anything if the
+ // source and destination files are hard linked
+ Sys::unlink(src.item); // just remove it
src.item = basedoc; // change job reference
}
}