]> diplodocus.org Git - nmh/blobdiff - sbr/folder_addmsg.c
Hoist test of search string for NULL out of loop.
[nmh] / sbr / folder_addmsg.c
index a0595e6ecab1093ff6b79f47d9edb349851c6928..f6a9af330ed38eba7d91cea486567acd9152b21d 100644 (file)
@@ -9,7 +9,6 @@
 
 #include <h/mh.h>
 #include <fcntl.h>
 
 #include <h/mh.h>
 #include <fcntl.h>
-#include <errno.h>
 
 /*
  * Link message into a folder.  Return the new number
 
 /*
  * Link message into a folder.  Return the new number
@@ -135,7 +134,7 @@ folder_addmsg (struct msgs **mpp, char *msgfile, int selected,
                (void)ext_hook("ref-hook", oldmsg, newmsg);
            }
            else
                (void)ext_hook("ref-hook", oldmsg, newmsg);
            }
            else
-               (void)ext_hook("add-hook", newmsg, (char *)0);
+               (void)ext_hook("add-hook", newmsg, NULL);
 
            return msgnum;
        } else {
 
            return msgnum;
        } else {
@@ -166,8 +165,9 @@ folder_addmsg (struct msgs **mpp, char *msgfile, int selected,
             * 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, then check if there is a message
             * already in the desired location.  If so, then return
             * error, else just copy the message.
+            * Cygwin with FAT32 filesystem produces EPERM.
             */
             */
-           if (linkerr == EXDEV) {
+           if (linkerr == EXDEV  ||  linkerr == EPERM) {
                if (stat (newmsg, &st1) == 0) {
                    advise (NULL, "message %s:%s already exists", mp->foldpath, newmsg);
                    return -1;
                if (stat (newmsg, &st1) == 0) {
                    advise (NULL, "message %s:%s already exists", mp->foldpath, newmsg);
                    return -1;
@@ -191,7 +191,7 @@ folder_addmsg (struct msgs **mpp, char *msgfile, int selected,
                        (void)ext_hook("ref-hook", oldmsg, newmsg);
                    }
                    else
                        (void)ext_hook("ref-hook", oldmsg, newmsg);
                    }
                    else
-                       (void)ext_hook("add-hook", newmsg, (char *)0);
+                       (void)ext_hook("add-hook", newmsg, NULL);
 
                    return msgnum;
                }
 
                    return msgnum;
                }