From: David Levine Date: Sat, 25 Jan 2014 16:04:19 +0000 (-0600) Subject: Replaced nearly all unlink(3) calls with m_unlink(). X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/8cebca1119664be52f1cbccd0ee052ae0b8c1de0?ds=inline;hp=-c Replaced nearly all unlink(3) calls with m_unlink(). --- 8cebca1119664be52f1cbccd0ee052ae0b8c1de0 diff --git a/sbr/folder_delmsgs.c b/sbr/folder_delmsgs.c index ee4bd9e9..db593f80 100644 --- a/sbr/folder_delmsgs.c +++ b/sbr/folder_delmsgs.c @@ -112,7 +112,7 @@ folder_delmsgs (struct msgs *mp, int unlink_msgs, int nohook) if (unlink_msgs) { /* just unlink the messages */ - if (unlink (dp) == -1) { + if (m_unlink (dp) == -1) { admonish (dp, "unable to unlink"); retval = -1; continue; diff --git a/sbr/lock_file.c b/sbr/lock_file.c index 6a3be519..1a562f9b 100644 --- a/sbr/lock_file.c +++ b/sbr/lock_file.c @@ -335,7 +335,7 @@ lkclose_dot (int fd, const char *file) lockname (file, &lkinfo, 0); /* get name of lock file */ #if !defined(HAVE_LIBLOCKFILE) - unlink (lkinfo.curlock); /* remove lock file */ + (void) m_unlink (lkinfo.curlock); /* remove lock file */ #else lockfile_remove(lkinfo.curlock); #endif /* HAVE_LIBLOCKFILE */ @@ -513,7 +513,7 @@ lkopen_dot (const char *file, int access, mode_t mode) /* check for stale lockfile, else sleep */ if (curtime > st.st_ctime + RSECS) - unlink (lkinfo.curlock); + (void) m_unlink (lkinfo.curlock); else sleep (5); } @@ -569,7 +569,7 @@ lockit (struct lockinfo *li) * by linking to the temporary file. */ fd = link(tmpfile, curlock); - unlink(tmpfile); + (void) m_unlink(tmpfile); return (fd == -1 ? -1 : 0); } diff --git a/sbr/m_backup.c b/sbr/m_backup.c index c34c4097..5e24a033 100644 --- a/sbr/m_backup.c +++ b/sbr/m_backup.c @@ -23,6 +23,6 @@ m_backup (char *file) snprintf(buffer, sizeof(buffer), "%.*s%s%s", (int)(cp - file), file, BACKUP_PREFIX, cp); - unlink(buffer); + (void) m_unlink(buffer); return buffer; } diff --git a/sbr/m_mktemp.c b/sbr/m_mktemp.c index cc9c45f5..ac05306a 100644 --- a/sbr/m_mktemp.c +++ b/sbr/m_mktemp.c @@ -77,7 +77,7 @@ m_mktemp ( FILE *fp = fdopen(fd, "w+"); if (fp == NULL) { int olderr = errno; - unlink(tmpfil); + (void) m_unlink(tmpfil); close(fd); errno = olderr; umask(oldmode); diff --git a/sbr/seq_save.c b/sbr/seq_save.c index 83753afb..5b06dcdf 100644 --- a/sbr/seq_save.c +++ b/sbr/seq_save.c @@ -91,7 +91,7 @@ priv: rewind(fp); ftruncate(fileno(fp), 0); } else if ((fp = lkfopendata (seqfile, "w")) == NULL - && (unlink (seqfile) == -1 || + && (m_unlink (seqfile) == -1 || (fp = lkfopendata (seqfile, "w")) == NULL)) { admonish (attr, "unable to write"); goto priv; @@ -118,7 +118,7 @@ priv: * public sequences, then remove that file. */ if (!is_readonly(mp)) - unlink (seqfile); + (void) m_unlink (seqfile); } /* diff --git a/uip/annosbr.c b/uip/annosbr.c index 2f40560b..88c90f44 100644 --- a/uip/annosbr.c +++ b/uip/annosbr.c @@ -415,13 +415,13 @@ annosbr (int fd, char *file, char *comp, char *text, int inplace, int datesw, in cpydata (tmpfd, fd, tmpfil, file); close (tmpfd); - unlink (tmpfil); + (void) m_unlink (tmpfil); } else { strncpy (buffer, m_backup (file), sizeof(buffer)); if (rename (file, buffer) == NOTOK) { switch (errno) { case ENOENT: /* unlinked early - no annotations */ - unlink (tmpfil); + (void) m_unlink (tmpfil); break; default: diff --git a/uip/attach.c b/uip/attach.c index 9ff7d095..8be4ed2a 100644 --- a/uip/attach.c +++ b/uip/attach.c @@ -105,7 +105,7 @@ attach(char *attachment_header_field_name, char *draft_file_name, } (void)strncpy(body_file_name, p, body_file_name_len); if ((p = m_mktemp2(NULL, invo_name, NULL, NULL)) == NULL) { - unlink(body_file_name); + (void) m_unlink(body_file_name); adios(NULL, "unable to create temporary file in %s", get_temp_dir()); } (void)strncpy(composition_file_name, p, composition_file_name_len); @@ -237,8 +237,8 @@ void clean_up_temporary_files(const char *body_file_name, const char *composition_file_name) { - (void) unlink(body_file_name); - (void) unlink(composition_file_name); + (void) m_unlink(body_file_name); + (void) m_unlink(composition_file_name); return; } diff --git a/uip/distsbr.c b/uip/distsbr.c index d371ec1d..2d9239e9 100644 --- a/uip/distsbr.c +++ b/uip/distsbr.c @@ -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; @@ -147,7 +147,7 @@ ready_msg (char *msgnam) 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; @@ -177,7 +177,7 @@ ready_msg (char *msgnam) 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; diff --git a/uip/dropsbr.c b/uip/dropsbr.c index 2cf5b598..da2752d1 100644 --- a/uip/dropsbr.c +++ b/uip/dropsbr.c @@ -567,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)) { - unlink (file); + (void) m_unlink (file); mbx_close (file, fd); if ((fd = map_open (file, md)) == NOTOK) return NOTOK; diff --git a/uip/forwsbr.c b/uip/forwsbr.c index 90838e24..295507d6 100644 --- a/uip/forwsbr.c +++ b/uip/forwsbr.c @@ -178,7 +178,7 @@ finished: adios(NULL, "unable to create temporary file in %s", get_temp_dir()); } strncpy (tmpfil, cp, sizeof(tmpfil)); - unlink (tmpfil); + (void) m_unlink (tmpfil); if ((in = dup (fileno (tmp))) == NOTOK) adios ("dup", "unable to"); diff --git a/uip/inc.c b/uip/inc.c index bf8216f4..b76f1cd9 100644 --- a/uip/inc.c +++ b/uip/inc.c @@ -656,7 +656,7 @@ go_to_it: } else { if (ferror(pf) || fclose (pf)) { int e = errno; - unlink (cp); + (void) m_unlink (cp); pop_quit (); errno = e; adios (cp, "write error on"); @@ -751,7 +751,7 @@ go_to_it: break; if (ferror(sf) || fflush(pf) || ferror(pf)) { int e = errno; - fclose(pf); fclose(sf); unlink(cp); + fclose(pf); fclose(sf); (void) m_unlink(cp); errno = e; adios(cp, "copy error %s -> %s", sp, cp); } @@ -798,14 +798,14 @@ go_to_it: } if (ferror(pf) || fclose (pf)) { int e = errno; - unlink (cp); + (void) m_unlink (cp); errno = e; adios (cp, "write error on"); } pf = NULL; free (cp); - if (trnflag && unlink (sp) == NOTOK) + if (trnflag && m_unlink (sp) == NOTOK) adios (sp, "couldn't unlink"); free (sp); /* Free Maildir[i]->filename */ } @@ -847,7 +847,7 @@ go_to_it: close (newfd); else admonish (newmail, "error zero'ing"); - unlink(map_name(newmail)); + (void) m_unlink(map_name(newmail)); } } else { if (noisy) diff --git a/uip/mhbuild.c b/uip/mhbuild.c index b0ef72ae..1a160711 100644 --- a/uip/mhbuild.c +++ b/uip/mhbuild.c @@ -341,7 +341,7 @@ main (int argc, char **argv) free_content (ct); } - unlink (infile); + (void) m_unlink (infile); unlink_infile = 0; done (0); @@ -410,9 +410,9 @@ unlink_done (int status) * temporary files. */ if (unlink_infile) - unlink (infile); + (void) m_unlink (infile); if (unlink_outfile) - unlink (outfile); + (void) m_unlink (outfile); exit (status); } diff --git a/uip/mhcachesbr.c b/uip/mhcachesbr.c index 0bf725c6..136b5678 100644 --- a/uip/mhcachesbr.c +++ b/uip/mhcachesbr.c @@ -143,11 +143,11 @@ cache_content (CT ct) if (ferror (gp)) { admonish (ce->ce_file, "error reading"); - unlink (cachefile); + (void) m_unlink (cachefile); } else { if (ferror (fp)) { admonish (cachefile, "error writing"); - unlink (cachefile); + (void) m_unlink (cachefile); } } fclose (fp); @@ -273,7 +273,7 @@ got_it: if (status == OK && writing) { if (*writing && strchr(buffer, '/')) make_intermediates (buffer); - unlink (buffer); + (void) m_unlink (buffer); } free (id); diff --git a/uip/mhfixmsg.c b/uip/mhfixmsg.c index a59ca509..20162508 100644 --- a/uip/mhfixmsg.c +++ b/uip/mhfixmsg.c @@ -293,7 +293,7 @@ main (int argc, char **argv) { } if (close (fd)) { - unlink (file); + (void) m_unlink (file); adios (NULL, "failed to write temporary file"); } } @@ -356,7 +356,7 @@ main (int argc, char **argv) { status += mhfixmsgsbr (ctp, &fx, outfile); if (using_stdin) { - unlink (file); + (void) m_unlink (file); if (! outfile) { /* Just calling m_backup() unlinks the backup file. */ @@ -457,7 +457,7 @@ mhfixmsgsbr (CT *ctp, const fix_transformations *fx, char *outfile) { } if (modify_inplace) { - if (status != OK) unlink (outfile); + if (status != OK) (void) m_unlink (outfile); free (outfile); outfile = NULL; } @@ -1035,7 +1035,7 @@ build_text_plain_part (CT encoded_part) { } free_content (tp_part); - unlink (tmp_plain_file); + (void) m_unlink (tmp_plain_file); free (tmp_plain_file); return NULL; @@ -1106,7 +1106,7 @@ decode_part (CT ct) { filename of the decoded content. tmp_decoded will contain the encoded output, get rid of that. */ status = output_message (ct, tmp_decoded); - unlink (tmp_decoded); + (void) m_unlink (tmp_decoded); free (tmp_decoded); return status; @@ -1166,7 +1166,7 @@ reformat_part (CT ct, char *file, char *type, char *subtype, int c_type) { /* Unlink decoded content tmp file and free its filename to avoid leaks. The file stream should already have been closed. */ if (ct->c_cefile.ce_unlink) { - unlink (ct->c_cefile.ce_file); + (void) m_unlink (ct->c_cefile.ce_file); free (ct->c_cefile.ce_file); ct->c_cefile.ce_file = NULL; ct->c_cefile.ce_unlink = 0; @@ -1486,7 +1486,7 @@ decode_text_parts (CT ct, int encoding, int *message_mods) { : ct->c_ctline ? ct->c_ctline : ""); } - unlink (ct->c_cefile.ce_file); + (void) m_unlink (ct->c_cefile.ce_file); free (ct->c_cefile.ce_file); ct->c_cefile.ce_file = NULL; } else if (ct->c_encoding == CE_QUOTED && @@ -1500,7 +1500,7 @@ decode_text_parts (CT ct, int encoding, int *message_mods) { : ct->c_ctline ? ct->c_ctline : ""); } - unlink (ct->c_cefile.ce_file); + (void) m_unlink (ct->c_cefile.ce_file); free (ct->c_cefile.ce_file); ct->c_cefile.ce_file = NULL; } else { @@ -1723,13 +1723,13 @@ strip_crs (CT ct, int *message_mods) { if (close (fd)) { admonish (NULL, "unable to write temporary file %s", stripped_content_file); - unlink (stripped_content_file); + (void) m_unlink (stripped_content_file); status = NOTOK; } else { /* Replace the decoded file with the converted one. */ if (ct->c_cefile.ce_file) { if (ct->c_cefile.ce_unlink) { - unlink (ct->c_cefile.ce_file); + (void) m_unlink (ct->c_cefile.ce_file); } free (ct->c_cefile.ce_file); } @@ -1923,7 +1923,7 @@ convert_codeset (CT ct, char *dest_codeset, int *message_mods) { /* Replace the decoded file with the converted one. */ if (ct->c_cefile.ce_file) { if (ct->c_cefile.ce_unlink) { - unlink (ct->c_cefile.ce_file); + (void) m_unlink (ct->c_cefile.ce_file); } free (ct->c_cefile.ce_file); } @@ -1962,7 +1962,7 @@ convert_codeset (CT ct, char *dest_codeset, int *message_mods) { } } } else { - unlink (dest); + (void) m_unlink (dest); } #else /* ! HAVE_ICONV */ NMH_UNUSED (message_mods); @@ -2012,7 +2012,7 @@ write_content (CT ct, char *input_filename, char *outfile, int modify_inplace, } if (new != -1) close (new); if (old != -1) close (old); - unlink (outfile); + (void) m_unlink (outfile); if (i < 0) { /* The -file argument processing used path() to @@ -2028,7 +2028,7 @@ write_content (CT ct, char *input_filename, char *outfile, int modify_inplace, } else { admonish (NULL, "unable to remove input file %s, " "not modifying it", infile); - unlink (outfile); + (void) m_unlink (outfile); status = NOTOK; } @@ -2038,7 +2038,7 @@ write_content (CT ct, char *input_filename, char *outfile, int modify_inplace, } } else { /* No modifications and didn't need the tmp outfile. */ - unlink (outfile); + (void) m_unlink (outfile); } } else { /* Output is going to some file. Produce it whether or not diff --git a/uip/mhfree.c b/uip/mhfree.c index 5fa2a59c..29756876 100644 --- a/uip/mhfree.c +++ b/uip/mhfree.c @@ -106,7 +106,7 @@ free_content (CT ct) if (ct->c_file) { if (ct->c_unlink) - unlink (ct->c_file); + (void) m_unlink (ct->c_file); free (ct->c_file); } if (ct->c_fp) @@ -270,7 +270,7 @@ free_encoding (CT ct, int toplevel) if (ce->ce_file) { if (ce->ce_unlink) - unlink (ce->ce_file); + (void) m_unlink (ce->ce_file); free (ce->ce_file); ce->ce_file = NULL; } diff --git a/uip/mhparse.c b/uip/mhparse.c index 58f3a81c..716a22f7 100644 --- a/uip/mhparse.c +++ b/uip/mhparse.c @@ -205,12 +205,12 @@ parse_mime (char *file) fflush (fp); if (ferror (stdin)) { - unlink (file); + (void) m_unlink (file); advise ("stdin", "error reading"); return NULL; } if (ferror (fp)) { - unlink (file); + (void) m_unlink (file); advise (file, "error writing"); return NULL; } @@ -222,7 +222,7 @@ parse_mime (char *file) if (!(ct = get_content (fp, file, 1))) { if (is_stdin) - unlink (file); + (void) m_unlink (file); advise (NULL, "unable to decode %s", file); return NULL; } @@ -2340,12 +2340,12 @@ openFile (CT ct, char **file) if (ferror (gp)) { admonish (ce->ce_file, "error reading"); - unlink (cachefile); + (void) m_unlink (cachefile); } else if (ferror (fp)) { admonish (cachefile, "error writing"); - unlink (cachefile); + (void) m_unlink (cachefile); } fclose (fp); } @@ -2556,12 +2556,12 @@ openFTP (CT ct, char **file) if (ferror (gp)) { admonish (ce->ce_file, "error reading"); - unlink (cachefile); + (void) m_unlink (cachefile); } else if (ferror (fp)) { admonish (cachefile, "error writing"); - unlink (cachefile); + (void) m_unlink (cachefile); } fclose (fp); } @@ -2831,7 +2831,7 @@ openURL (CT ct, char **file) if (ferror(gp)) { admonish(ce->ce_file, "error reading"); - unlink(cachefile); + (void) m_unlink (cachefile); } } umask(mask); diff --git a/uip/mhstoresbr.c b/uip/mhstoresbr.c index 3b689702..7b1dbd51 100644 --- a/uip/mhstoresbr.c +++ b/uip/mhstoresbr.c @@ -626,7 +626,7 @@ got_filename: */ if (ct->c_folder && (!is_partial || last_partial)) { msgnum = output_content_folder (ct->c_folder, ct->c_storage); - unlink (ct->c_storage); + (void) m_unlink (ct->c_storage); if (msgnum == NOTOK) return NOTOK; } diff --git a/uip/mhtest.c b/uip/mhtest.c index 30459136..b85a91ea 100644 --- a/uip/mhtest.c +++ b/uip/mhtest.c @@ -343,7 +343,6 @@ static void pipeser (int i) { if (i == SIGQUIT) { - unlink ("core"); fflush (stdout); fprintf (stderr, "\n"); fflush (stderr); diff --git a/uip/msh.c b/uip/msh.c index fbfb408e..e91924c3 100644 --- a/uip/msh.c +++ b/uip/msh.c @@ -1114,7 +1114,7 @@ quit (void) close (i); else advise (mp->foldpath, "error zero'ing"); - unlink (map_name (mp->foldpath));/* XXX */ + (void) m_unlink (map_name (mp->foldpath));/* XXX */ } goto release; } @@ -1131,8 +1131,8 @@ quit (void) for (msgnum = mp->lowmsg; msgnum <= mp->hghmsg; msgnum++) if (does_exist(mp, msgnum) && pack (tmpfil, md, msgnum) == NOTOK) { mbx_close (tmpfil, md); - unlink (tmpfil); - unlink (map_name (tmpfil)); + (void) m_unlink (tmpfil); + (void) m_unlink (map_name (tmpfil)); goto release; } mbx_close (tmpfil, md); @@ -1145,8 +1145,8 @@ quit (void) if (rename (map1, map2) == NOTOK) { admonish (map2, "unable to rename %s to", map1); - unlink (map1); - unlink (map2); + (void) m_unlink (map1); + (void) m_unlink (map2); } } diff --git a/uip/mshcmds.c b/uip/mshcmds.c index 3a5f98fa..6627c6ab 100644 --- a/uip/mshcmds.c +++ b/uip/mshcmds.c @@ -1011,7 +1011,7 @@ forw (char *proc, char *filter, int vecp, char **vec) break; } - unlink (tmpfil); + (void) m_unlink (tmpfil); } @@ -2842,7 +2842,7 @@ ready: ; } if (!fmsh) - unlink (tmpfil); + (void) m_unlink (tmpfil); return status; } diff --git a/uip/post.c b/uip/post.c index 5d227c40..9b358521 100644 --- a/uip/post.c +++ b/uip/post.c @@ -630,13 +630,13 @@ main (int argc, char **argv) post (tmpfil, 0, verbose, envelope); } post (bccfil, 1, verbose, envelope); - unlink (bccfil); + (void) m_unlink (bccfil); } else { post (tmpfil, 0, isatty (1), envelope); } p_refile (tmpfil); - unlink (tmpfil); + (void) m_unlink (tmpfil); if (verbose) { if (partno) @@ -1705,9 +1705,9 @@ sigser (int i) { NMH_UNUSED (i); - unlink (tmpfil); + (void) m_unlink (tmpfil); if (msgflags & MINV) - unlink (bccfil); + (void) m_unlink (bccfil); if (!whomsw || checksw) sm_end (NOTOK); @@ -1829,9 +1829,9 @@ die (char *what, char *fmt, ...) { va_list ap; - unlink (tmpfil); + (void) m_unlink (tmpfil); if (msgflags & MINV) - unlink (bccfil); + (void) m_unlink (bccfil); if (!whomsw || checksw) sm_end (NOTOK); diff --git a/uip/prompter.c b/uip/prompter.c index 35052e62..37f5960b 100644 --- a/uip/prompter.c +++ b/uip/prompter.c @@ -227,7 +227,7 @@ abort: if (killp || erasep) { tcsetattr(0, TCSADRAIN, &tio); } - unlink (tmpfil); + (void) m_unlink (tmpfil); done (1); } if (i != 0 || (field[0] != '\n' && field[0] != 0)) { @@ -316,7 +316,7 @@ abort: cpydata (fdi, fdo, tmpfil, drft); close (fdi); close (fdo); - unlink (tmpfil); + (void) m_unlink (tmpfil); context_save (); /* save the context file */ done (0); diff --git a/uip/rcvdist.c b/uip/rcvdist.c index a87a5e84..85baf33d 100644 --- a/uip/rcvdist.c +++ b/uip/rcvdist.c @@ -253,11 +253,11 @@ static void unlink_done (int status) { if (backup[0]) - unlink (backup); + (void) m_unlink (backup); if (drft[0]) - unlink (drft); + (void) m_unlink (drft); if (tmpfil[0]) - unlink (tmpfil); + (void) m_unlink (tmpfil); exit (status ? RCV_MBX : RCV_MOK); } diff --git a/uip/rcvstore.c b/uip/rcvstore.c index 64b4a007..be0ac396 100644 --- a/uip/rcvstore.c +++ b/uip/rcvstore.c @@ -166,7 +166,7 @@ main (int argc, char **argv) cpydata (fileno (stdin), fd, "standard input", tmpfilenam); if (fstat (fd, &st) == NOTOK) { - unlink (tmpfilenam); + (void) m_unlink (tmpfilenam); adios (tmpfilenam, "unable to fstat"); } if (close (fd) == NOTOK) @@ -174,7 +174,7 @@ main (int argc, char **argv) /* don't add file if it is empty */ if (st.st_size == 0) { - unlink (tmpfilenam); + (void) m_unlink (tmpfilenam); advise (NULL, "empty file"); done (0); } @@ -212,7 +212,7 @@ main (int argc, char **argv) folder_free (mp); /* free folder/message structure */ context_save (); /* save the global context file */ - unlink (tmpfilenam); /* remove temporary file */ + (void) m_unlink (tmpfilenam); /* remove temporary file */ tmpfilenam = NULL; done (0); @@ -226,6 +226,6 @@ static void unlink_done(int status) { if (tmpfilenam && *tmpfilenam) - unlink (tmpfilenam); + (void) m_unlink (tmpfilenam); exit (status); } diff --git a/uip/rcvtty.c b/uip/rcvtty.c index 8ddc15d1..3bee075e 100644 --- a/uip/rcvtty.c +++ b/uip/rcvtty.c @@ -192,7 +192,7 @@ message_fd (char **vec) advise(NULL, "unable to create temporary file in %s", get_temp_dir()); return NOTOK; } - m_unlink(tfile); /* Use fd, no longer need the file name. */ + (void) m_unlink(tfile); /* Use fd, no longer need the file name. */ if ((child_id = fork()) == NOTOK) { /* fork error */ @@ -256,7 +256,7 @@ header_fd (void) advise(NULL, "unable to create temporary file in %s", get_temp_dir()); return NOTOK; } - m_unlink(tfile); /* Use fd, no longer need the file name. */ + (void) m_unlink(tfile); /* Use fd, no longer need the file name. */ rewind (stdin); diff --git a/uip/refile.c b/uip/refile.c index 1dc2dff4..ecbe3466 100644 --- a/uip/refile.c +++ b/uip/refile.c @@ -338,7 +338,7 @@ remove_files (int filep, char **files) /* Else just unlink the files */ files++; /* advance past filevec[0] */ for (i = 0; i < filep; i++) { - if (unlink (files[i]) == NOTOK) + if (m_unlink (files[i]) == NOTOK) admonish (files[i], "unable to unlink"); } } diff --git a/uip/rmf.c b/uip/rmf.c index 765ec9e1..bb03805a 100644 --- a/uip/rmf.c +++ b/uip/rmf.c @@ -179,7 +179,7 @@ rmf (char *folder) others++; continue; } - if (unlink (dp->d_name) == NOTOK) { + if (m_unlink (dp->d_name) == NOTOK) { admonish (dp->d_name, "unable to unlink %s:", folder); others++; } diff --git a/uip/send.c b/uip/send.c index c8ad788b..9d6e2076 100644 --- a/uip/send.c +++ b/uip/send.c @@ -397,7 +397,7 @@ go_to_it: get_temp_dir()); } distfile = getcpy (cp); - unlink(distfile); + (void) m_unlink(distfile); if (link (altmsg, distfile) == NOTOK) { /* Cygwin with FAT32 filesystem produces EPERM. */ if (errno != EXDEV && errno != EPERM diff --git a/uip/sendsbr.c b/uip/sendsbr.c index c1914aa1..ad48b882 100644 --- a/uip/sendsbr.c +++ b/uip/sendsbr.c @@ -143,7 +143,7 @@ sendsbr (char **vec, int vecp, char *program, char *drft, struct stat *st, done=exit; if (distfile) - unlink (distfile); + (void) m_unlink (distfile); /* * Get rid of any temporary files that we created for attachments. Also get rid of @@ -168,7 +168,7 @@ sendsbr (char **vec, int vecp, char *program, char *drft, struct stat *st, (void)strcpy(p, body_file_name); (void)strcat(p, ".orig"); - (void)unlink(composition_file_name); + (void)m_unlink(composition_file_name); } } @@ -389,7 +389,7 @@ splitmsg (char **vec, int vecp, char *program, char *drft, snprintf (partnum, sizeof(partnum), "%d", partno); status = sendaux (vec, vecp, program, tmpdrf, st); - unlink (tmpdrf); + (void) m_unlink (tmpdrf); if (status != OK) break; @@ -487,7 +487,7 @@ sendaux (char **vec, int vecp, char *program, char *drft, struct stat *st) if (annotext && fd2 != NOTOK) close (fd2); if (distfile) { - unlink (drft); + (void) m_unlink (drft); if (rename (backup, drft) == NOTOK) advise (drft, "unable to rename %s to", backup); } @@ -580,7 +580,7 @@ tmp_fd (void) if (debugsw) advise (NULL, "temporary file %s selected", tfile); else - if (unlink (tfile) == NOTOK) + if (m_unlink (tfile) == NOTOK) advise (tfile, "unable to remove"); return fd; diff --git a/uip/slocal.c b/uip/slocal.c index 6e22076a..eaa7cb7c 100644 --- a/uip/slocal.c +++ b/uip/slocal.c @@ -336,7 +336,7 @@ main (int argc, char **argv) thing would be to delay this unlink() until later if debug == 1, but I'll leave that for someone who cares about the temp-file-accessing functionality (they'll have to watch out for cases where we adios()). */ - unlink (tmpfil); + (void) m_unlink (tmpfil); if (!(fp = fdopen (fd, "r+"))) adios (NULL, "unable to access temporary file"); @@ -1200,7 +1200,7 @@ copy_message (int qd, char *tmpfil, int fold) if (write (fd1, buffer, i) != i) { you_lose: close (fd1); - unlink (tmpfil); + (void) m_unlink (tmpfil); return -1; } if (i == -1) diff --git a/uip/viamail.c b/uip/viamail.c index 10adf537..6bce740f 100644 --- a/uip/viamail.c +++ b/uip/viamail.c @@ -253,8 +253,8 @@ via_mail (char *mailsw, char *subjsw, char *parmsw, char *descsw, } fclose (fp); - if (unlink (tmpfil) == -1) - advise (NULL, "unable to remove temp file %s", tmpfil); + if (m_unlink (tmpfil) == -1) + advise (tmpfil, "unable to remove temp file %s", tmpfil); done (status); return 1; } diff --git a/uip/whatnowsbr.c b/uip/whatnowsbr.c index 3663f478..7f5c6c3c 100644 --- a/uip/whatnowsbr.c +++ b/uip/whatnowsbr.c @@ -235,7 +235,7 @@ WhatNow (int argc, char **argv) #else /* ! READLINE_SUPPORT */ if (!(argp = getans (prompt, aleqs))) { #endif /* READLINE_SUPPORT */ - unlink (LINK); + (void) m_unlink (LINK); done (1); } switch (smatch (*argp, aleqs)) { @@ -696,7 +696,7 @@ editfile (char **ed, char **arg, char *file, int use, struct msgs *mp, snprintf (linkpath, sizeof(linkpath), "%s/%s", cwd, LINK); if (atfile) { - unlink (linkpath); + (void) m_unlink (linkpath); if (link (altpath, linkpath) == NOTOK) { symlink (altpath, linkpath); slinked = 1; @@ -762,7 +762,7 @@ editfile (char **ed, char **arg, char *file, int use, struct msgs *mp, && copyf (linkpath, altpath) == NOTOK : stat (linkpath, &st) != NOTOK && st.st_nlink == 1 - && (unlink (altpath) == NOTOK + && (m_unlink (altpath) == NOTOK || link (linkpath, altpath) == NOTOK))) advise (linkpath, "unable to update %s from", altmsg); } @@ -773,7 +773,7 @@ editfile (char **ed, char **arg, char *file, int use, struct msgs *mp, *ed = NULL; if (altmsg && atfile) - unlink (linkpath); + (void) m_unlink (linkpath); return status; } @@ -1304,7 +1304,7 @@ sendit (char *sp, char **arg, char *file, int pushed) get_temp_dir()); } distfile = getcpy (cp); - unlink(distfile); + (void) m_unlink(distfile); if (link (altmsg, distfile) == NOTOK) adios (distfile, "unable to link %s to", altmsg); } else { @@ -1370,7 +1370,7 @@ whomfile (char **arg, char *file) static int removefile (char *drft) { - if (unlink (drft) == NOTOK) + if (m_unlink (drft) == NOTOK) adios (drft, "unable to unlink"); return OK; diff --git a/uip/whom.c b/uip/whom.c index 980cdda5..2a36025a 100644 --- a/uip/whom.c +++ b/uip/whom.c @@ -196,7 +196,7 @@ main (int argc, char **argv) status = pidwait(child_id, OK); - unlink (msg); + (void) m_unlink (msg); if (rename (backup, msg) == NOTOK) adios (msg, "unable to rename %s to", backup); done (status);