Hi,
I'm using maildrop to deliver messages to maildirs within an NFS file
server... for some reason, the mechanism used within do_deliver_warning()
for updating the mtime doesn't work, so, after the initial warning message
is delivered, every incoming message generates a new warning message within
the maildir :-(
Reading 'man 2 stat' I see:
The field st_mtime is changed by file modifications, e.g. by mknod(2),
truncate(2), utime(2) and write(2) (of more than zero bytes). Moreover,
st_mtime of a directory is changed by the creation or deletion of files in
that directory. The st_mtime field is not changed for changes in owner,
group, hard link count, or mode.
So, the
write(fd, buf, 0)
seems to be useless in this context... however, the
open(qname, O_WRONLY|O_CREAT|O_TRUNC, 0644)
should implicitly call truncate(2)... as I wasn't sure (maybe it is smart
enough to NOT call truncate(2) when O_TRUNC is enabled IF it knows that the
current size is 0????
To test this I called
ftruncate(fd, 0)
after and before the write, to no avail...
What _did_ work was to actually write one byte to the file... to avoid
filling the disk with one-byte sized files, I'm truncating it immediately,
and this seems to work.
I applied the following patch (maildrop 1.6.3):
--- maildir/maildirquota.c.ORI Wed May 19 15:38:43 2004
+++ maildir/maildirquota.c Wed May 19 16:10:49 2004
@@ -967,7 +967,8 @@
close(fdin);
return;
}
- write(fd, buf, 0);
+ write(fd, buf, 1);
+ ftruncate(fd, 0);
close(fd);
strcpy(buf, "Date: ");
FWIW, this is on a RHES-2.1. The NFS server is a cluster of two RHAS-2.1
with HP ServiceGuard clustering software... I think the clustered
filesystem are ReiserFS.
Regards.
-----------------------------------------------------------
All wiyht. Rho sritched mg kegtops awound?