> Or, when a user
> tries to run inc, nmh could:
>
> - print a warning and have a -force option
> - default to less-than-perfect locking
I might generate a decent patch for that.
The enclosed patch does copy instead of link and complains loudly
until you recompile...
comp: lockit: *** WARNING ***
comp: lockit: GOOD file locking FAILED for /home/rader/Mail/context.lock
comp: lockit: filesystem does not support link
comp: lockit: doing BAD file locking (non-atomic copy) instead
comp: lockit: use at your own risk: you might LOOSE mail!!
comp: lockit: (compile with -DBROKEN_LOCKING to remove this message)
Can anyone tell me what's going on (how to excerise the code) on line
720 of uip/whatnowsbr.c?
Fwiw, exmh over nmh over sshfs over broadband exceeds my expectations.
steve
--
--- folder_addmsg.c.orig 2007-03-20 19:21:10.000000000 -0500
+++ folder_addmsg.c 2008-10-19 14:40:02.000000000 -0500
@@ -174,11 +174,11 @@
/*
* If link failed because we are trying to link
- * across devices, then check if there is a message
- * already in the desired location. If so, then return
- * error, else just copy the message.
+ * across devices or don't have link(), then check if
+ * there is a message already in the desired location.
+ * If so, then return error, else just copy the message.
*/
- if (linkerr == EXDEV) {
+ if (linkerr == EXDEV || linkerr == ENOSYS) {
if (stat (newmsg, &st1) == 0) {
advise (NULL, "message %s:%s already exists", mp->foldpath,
newmsg);
return -1;
--- lock_file.c.orig 2008-04-05 13:41:37.000000000 -0500
+++ lock_file.c 2008-10-19 15:12:26.000000000 -0500
@@ -426,8 +426,9 @@
static int
lockit (struct lockinfo *li)
{
- int fd;
+ int fd, infd, outfd;
char *curlock, *tmplock;
+ struct stat st1, st2;
#if 0
char buffer[128];
@@ -462,6 +463,29 @@
* by linking to the temporary file.
*/
fd = link(tmplock, curlock);
+ if ( fd == -1 && errno == ENOSYS ) {
+#ifndef BROKEN_LOCKING
+ advise (NULL, "lockit: *** WARNING ***");
+ advise (NULL, "lockit: GOOD file locking FAILED for %s",curlock);
+ advise (NULL, "lockit: filesystem does not support link");
+ advise (NULL, "lockit: doing BAD file locking (non-atomic copy)
instead");
+ advise (NULL, "lockit: use at your own risk: you might LOOSE mail!!");
+ advise (NULL, "lockit: (compile with -DBROKEN_LOCKING to remove this
message)");
+#endif
+ if ((infd = open (tmplock, O_RDONLY)) == -1) {
+ advise (NULL, "lockit: unable to open tmplock %s", tmplock);
+ return -1;
+ }
+ fstat (infd, &st1);
+ if ((outfd = creat (curlock, (int) st1.st_mode & 0777)) == -1) {
+ advise (NULL, "lockit: unable to create %s", curlock);
+ close (infd);
+ return -1;
+ }
+ cpydata (infd, outfd, tmplock, curlock);
+ fd = outfd;
+ close (infd);
+ }
unlink(tmplock);
return (fd == -1 ? -1 : 0);
_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
http://lists.nongnu.org/mailman/listinfo/nmh-workers