]> diplodocus.org Git - nmh/blobdiff - uip/distsbr.c
Replaced use of mkstemp() with m_mktemp2() in header_fd() of
[nmh] / uip / distsbr.c
index b5119fbe88a39d9692b3b1dd78d1938e391881ef..d371ec1dbf77d709eb332c18b1d849ae50be3172 100644 (file)
@@ -28,8 +28,7 @@ int
 distout (char *drft, char *msgnam, char *backup)
 {
     int state;
 distout (char *drft, char *msgnam, char *backup)
 {
     int state;
-    register unsigned char *dp;
-    register char *resent;
+    char *dp, *resent;
     char name[NAMESZ], buffer[BUFSIZ];
     register FILE *ifp, *ofp;
     m_getfld_state_t gstate = 0;
     char name[NAMESZ], buffer[BUFSIZ];
     register FILE *ifp, *ofp;
     m_getfld_state_t gstate = 0;
@@ -74,7 +73,7 @@ distout (char *drft, char *msgnam, char *backup)
 
            case BODY: 
                for (dp = buffer; *dp; dp++)
 
            case BODY: 
                for (dp = buffer; *dp; dp++)
-                   if (!isspace (*dp)) {
+                   if (!isspace ((unsigned char) *dp)) {
                        advise (NULL, BADTXT, "draft");
                        goto leave_bad;
                    }
                        advise (NULL, BADTXT, "draft");
                        goto leave_bad;
                    }
@@ -142,9 +141,8 @@ ready_msg (char *msgnam)
 
     cp = m_mktemp2(NULL, "dist", &hdrfd, NULL);
     if (cp == NULL) {
 
     cp = m_mktemp2(NULL, "dist", &hdrfd, NULL);
     if (cp == NULL) {
-        adios("distsbr", "unable to create temporary file");
+       adios(NULL, "unable to create temporary file in %s", get_temp_dir());
     }
     }
-    fchmod(hdrfd, 0600);
     strncpy(tmpfil, cp, sizeof(tmpfil));
     if ((out = dup (hdrfd)) == NOTOK
            || (ofp = fdopen (out, "w")) == NULL)
     strncpy(tmpfil, cp, sizeof(tmpfil));
     if ((out = dup (hdrfd)) == NOTOK
            || (ofp = fdopen (out, "w")) == NULL)
@@ -171,7 +169,8 @@ ready_msg (char *msgnam)
 
                 cp = m_mktemp2(NULL, "dist", &txtfd, NULL);
                 if (cp == NULL) {
 
                 cp = m_mktemp2(NULL, "dist", &txtfd, NULL);
                 if (cp == NULL) {
-                    adios("distsbr", "unable to create temporary file");
+                   adios(NULL, "unable to create temporary file in %s",
+                         get_temp_dir());
                 }
                 fchmod(txtfd, 0600);
                strncpy (tmpfil, cp, sizeof(tmpfil));
                 }
                 fchmod(txtfd, 0600);
                strncpy (tmpfil, cp, sizeof(tmpfil));