]> diplodocus.org Git - nmh/blobdiff - uip/distsbr.c
Use RFC 2047 encoding for Content-Description, and make sure to encode
[nmh] / uip / distsbr.c
index d7a271209e383df2fc99f01f504e33cafebb365b..2d9239e92fd4495f627ceaf1d2896fa23af9ef25 100644 (file)
@@ -87,7 +87,7 @@ distout (char *drft, char *msgnam, char *backup)
        leave_bad: ;
                fclose (ifp);
                fclose (ofp);
-               unlink (drft);
+               (void) m_unlink (drft);
                if (rename (backup, drft) == NOTOK)
                    adios (drft, "unable to rename %s to", backup);
                return NOTOK;
@@ -104,7 +104,7 @@ process: ;
     if (!resent) {
        advise (NULL, BADMSG, "draft");
        fclose (ofp);
-       unlink (drft);
+       (void) m_unlink (drft);
        if (rename (backup, drft) == NOTOK)
            adios (drft, "unable to rename %s to", backup);
        return NOTOK;
@@ -141,14 +141,13 @@ ready_msg (char *msgnam)
 
     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)
        adios (NULL, "no file descriptors -- you lose big");
-    unlink (tmpfil);
+    (void) m_unlink (tmpfil);
 
     for (;;) {
        int buffersz = sizeof buffer;
@@ -170,14 +169,15 @@ ready_msg (char *msgnam)
 
                 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));
                if ((out = dup (txtfd)) == NOTOK
                        || (ofp = fdopen (out, "w")) == NULL)
                    adios (NULL, "no file descriptors -- you lose big");
-               unlink (tmpfil);
+               (void) m_unlink (tmpfil);
                fprintf (ofp, "\n%s", buffer);
                while (state == BODY) {
                    buffersz = sizeof buffer;