]> diplodocus.org Git - nmh/blobdiff - uip/dropsbr.c
Instead of printing PostScript attachments, by default, from mhshow,
[nmh] / uip / dropsbr.c
index 09ee2c1f6a698de052b8e738260888ed6e8af666..da2752d12debfd1f0cb2eccde51815d4fc989812 100644 (file)
@@ -14,7 +14,6 @@
 #include <h/dropsbr.h>
 #include <h/mts.h>
 #include <h/tws.h>
 #include <h/dropsbr.h>
 #include <h/mts.h>
 #include <h/tws.h>
-#include <errno.h>
 
 #ifdef NTOHLSWAP
 # include <netinet/in.h>
 
 #ifdef NTOHLSWAP
 # include <netinet/in.h>
@@ -41,7 +40,7 @@ static int map_open (char *, int);
 int
 mbx_open (char *file, int mbx_style, uid_t uid, gid_t gid, mode_t mode)
 {
 int
 mbx_open (char *file, int mbx_style, uid_t uid, gid_t gid, mode_t mode)
 {
-    int j, count, fd;
+    int j, count, fd = NOTOK;
     struct stat st;
 
     j = 0;
     struct stat st;
 
     j = 0;
@@ -62,7 +61,7 @@ mbx_open (char *file, int mbx_style, uid_t uid, gid_t gid, mode_t mode)
                case ETXTBSY: 
                    j = errno;
                    sleep (5);
                case ETXTBSY: 
                    j = errno;
                    sleep (5);
-                   break;
+                   continue;
 
                default: 
                    /* just return error */
 
                default: 
                    /* just return error */
@@ -307,6 +306,10 @@ mbx_copy (char *mailbox, int mbx_style, int md, int fd,
            }
                    
            while ((i = read (fd, buffer, sizeof(buffer))) > 0) {
            }
                    
            while ((i = read (fd, buffer, sizeof(buffer))) > 0) {
+                /* valgrind noticed that stringdex depends on null
+                   termination. */
+                buffer[i] = '\0';
+
                for (j = 0;
                        (j = stringdex (mmdlm1, buffer)) >= 0;
                        buffer[j]++)
                for (j = 0;
                        (j = stringdex (mmdlm1, buffer)) >= 0;
                        buffer[j]++)
@@ -564,7 +567,7 @@ map_write (char *mailbox, int md, int id, long last, off_t start,
        clear = 1;
 
     if (!clear && map_chk (file, fd, &d1, pos, noisy)) {
        clear = 1;
 
     if (!clear && map_chk (file, fd, &d1, pos, noisy)) {
-       unlink (file);
+       (void) m_unlink (file);
        mbx_close (file, fd);
        if ((fd = map_open (file, md)) == NOTOK)
            return NOTOK;
        mbx_close (file, fd);
        if ((fd = map_open (file, md)) == NOTOK)
            return NOTOK;