X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fslocal.c;h=e6880fe04420ebe42cb571063e4726f58dc721db;hb=119362982fae61ae7aaa899eaf2544e4f4a84283;hp=08a3e28b7d8c4d5e2b1cfe80f464766b98e54c45;hpb=13f84dd50ca5754391dbd3296a5c7425f9363600;p=mmh diff --git a/uip/slocal.c b/uip/slocal.c index 08a3e28..e6880fe 100644 --- a/uip/slocal.c +++ b/uip/slocal.c @@ -2,8 +2,6 @@ /* * slocal.c -- asynchronously filter and deliver new mail * - * $Id$ - * * This code is Copyright (c) 2002, by the authors of nmh. See the * COPYRIGHT file in the root directory of the nmh distribution for * complete copyright information. @@ -412,7 +410,8 @@ main (int argc, char **argv) /* deliver the message */ status = localmail (fd, mdlvr); - return done (status != -1 ? RCV_MOK : RCV_MBX); + done (status != -1 ? RCV_MOK : RCV_MBX); + return 1; } @@ -958,7 +957,7 @@ logged_in (void) while ((utp = getutent()) != NULL) { if ( -#ifdef HAVE_UTMP_UT_TYPE +#ifdef HAVE_STRUCT_UTMP_UT_TYPE utp->ut_type == USER_PROCESS && #endif @@ -1066,7 +1065,11 @@ usr_file (int fd, char *mailbox, int mbx_style) } /* close and unlock file */ - mbx_close (mailbox, md); + if (mbx_close (mailbox, md) == NOTOK) { + if (verbose) + adorn ("", "error closing:"); + return -1; + } if (verbose) verbose_printf (", success.\n"); @@ -1273,12 +1276,12 @@ copy_message (int qd, char *tmpfil, int fold) int i, first = 1, fd1, fd2; char buffer[BUFSIZ]; FILE *qfp, *ffp; + char *tfile = NULL; - strcpy (tmpfil, m_tmpfil (invo_name)); - - /* open temporary file to put message in */ - if ((fd1 = open (tmpfil, O_RDWR | O_CREAT | O_TRUNC, 0600)) == -1) - return -1; + tfile = m_mktemp2(NULL, invo_name, &fd1, NULL); + if (tfile == NULL) return -1; + fchmod(fd1, 0600); + strncpy (tmpfil, tfile, BUFSIZ); if (!fold) { while ((i = read (qd, buffer, sizeof(buffer))) > 0) @@ -1360,11 +1363,11 @@ you_lose: /* return path for UUCP style addressing */ ep = strchr(++hp, '\n'); snprintf (buffer, sizeof(buffer), "Return-Path: %.*s!%.*s\n", - ep - hp, hp, cp - fp, fp); + (int)(ep - hp), hp, (int)(cp - fp), fp); } else { /* return path for standard domain addressing */ snprintf (buffer, sizeof(buffer), "Return-Path: %.*s\n", - cp - fp, fp); + (int)(cp - fp), fp); } /* Add Return-Path header to message */