if (unlink_msgs) {
/* just unlink the messages */
- if (unlink (dp) == -1) {
+ if (m_unlink (dp) == -1) {
admonish (dp, "unable to unlink");
retval = -1;
continue;
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 */
/* check for stale lockfile, else sleep */
if (curtime > st.st_ctime + RSECS)
- unlink (lkinfo.curlock);
+ (void) m_unlink (lkinfo.curlock);
else
sleep (5);
}
* by linking to the temporary file.
*/
fd = link(tmpfile, curlock);
- unlink(tmpfile);
+ (void) m_unlink(tmpfile);
return (fd == -1 ? -1 : 0);
}
snprintf(buffer, sizeof(buffer), "%.*s%s%s", (int)(cp - file), file,
BACKUP_PREFIX, cp);
- unlink(buffer);
+ (void) m_unlink(buffer);
return buffer;
}
FILE *fp = fdopen(fd, "w+");
if (fp == NULL) {
int olderr = errno;
- unlink(tmpfil);
+ (void) m_unlink(tmpfil);
close(fd);
errno = olderr;
umask(oldmode);
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;
* public sequences, then remove that file.
*/
if (!is_readonly(mp))
- unlink (seqfile);
+ (void) m_unlink (seqfile);
}
/*
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:
}
(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);
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;
}
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;
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;
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;
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;
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;
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");
} else {
if (ferror(pf) || fclose (pf)) {
int e = errno;
- unlink (cp);
+ (void) m_unlink (cp);
pop_quit ();
errno = e;
adios (cp, "write error on");
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);
}
}
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 */
}
close (newfd);
else
admonish (newmail, "error zero'ing");
- unlink(map_name(newmail));
+ (void) m_unlink(map_name(newmail));
}
} else {
if (noisy)
free_content (ct);
}
- unlink (infile);
+ (void) m_unlink (infile);
unlink_infile = 0;
done (0);
* temporary files.
*/
if (unlink_infile)
- unlink (infile);
+ (void) m_unlink (infile);
if (unlink_outfile)
- unlink (outfile);
+ (void) m_unlink (outfile);
exit (status);
}
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);
if (status == OK && writing) {
if (*writing && strchr(buffer, '/'))
make_intermediates (buffer);
- unlink (buffer);
+ (void) m_unlink (buffer);
}
free (id);
}
if (close (fd)) {
- unlink (file);
+ (void) m_unlink (file);
adios (NULL, "failed to write temporary file");
}
}
status += mhfixmsgsbr (ctp, &fx, outfile);
if (using_stdin) {
- unlink (file);
+ (void) m_unlink (file);
if (! outfile) {
/* Just calling m_backup() unlinks the backup file. */
}
if (modify_inplace) {
- if (status != OK) unlink (outfile);
+ if (status != OK) (void) m_unlink (outfile);
free (outfile);
outfile = NULL;
}
}
free_content (tp_part);
- unlink (tmp_plain_file);
+ (void) m_unlink (tmp_plain_file);
free (tmp_plain_file);
return NULL;
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;
/* 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;
: 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 &&
: 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 (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);
}
/* 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);
}
}
}
} else {
- unlink (dest);
+ (void) m_unlink (dest);
}
#else /* ! HAVE_ICONV */
NMH_UNUSED (message_mods);
}
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
} else {
admonish (NULL, "unable to remove input file %s, "
"not modifying it", infile);
- unlink (outfile);
+ (void) m_unlink (outfile);
status = NOTOK;
}
}
} 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
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)
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;
}
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;
}
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;
}
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);
}
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);
}
if (ferror(gp)) {
admonish(ce->ce_file, "error reading");
- unlink(cachefile);
+ (void) m_unlink (cachefile);
}
}
umask(mask);
*/
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;
}
pipeser (int i)
{
if (i == SIGQUIT) {
- unlink ("core");
fflush (stdout);
fprintf (stderr, "\n");
fflush (stderr);
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;
}
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);
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);
}
}
break;
}
- unlink (tmpfil);
+ (void) m_unlink (tmpfil);
}
}
if (!fmsh)
- unlink (tmpfil);
+ (void) m_unlink (tmpfil);
return status;
}
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)
{
NMH_UNUSED (i);
- unlink (tmpfil);
+ (void) m_unlink (tmpfil);
if (msgflags & MINV)
- unlink (bccfil);
+ (void) m_unlink (bccfil);
if (!whomsw || checksw)
sm_end (NOTOK);
{
va_list ap;
- unlink (tmpfil);
+ (void) m_unlink (tmpfil);
if (msgflags & MINV)
- unlink (bccfil);
+ (void) m_unlink (bccfil);
if (!whomsw || checksw)
sm_end (NOTOK);
if (killp || erasep) {
tcsetattr(0, TCSADRAIN, &tio);
}
- unlink (tmpfil);
+ (void) m_unlink (tmpfil);
done (1);
}
if (i != 0 || (field[0] != '\n' && field[0] != 0)) {
cpydata (fdi, fdo, tmpfil, drft);
close (fdi);
close (fdo);
- unlink (tmpfil);
+ (void) m_unlink (tmpfil);
context_save (); /* save the context file */
done (0);
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);
}
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)
/* 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);
}
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);
unlink_done(int status)
{
if (tmpfilenam && *tmpfilenam)
- unlink (tmpfilenam);
+ (void) m_unlink (tmpfilenam);
exit (status);
}
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 */
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);
/* 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");
}
}
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++;
}
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
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
(void)strcpy(p, body_file_name);
(void)strcat(p, ".orig");
- (void)unlink(composition_file_name);
+ (void)m_unlink(composition_file_name);
}
}
snprintf (partnum, sizeof(partnum), "%d", partno);
status = sendaux (vec, vecp, program, tmpdrf, st);
- unlink (tmpdrf);
+ (void) m_unlink (tmpdrf);
if (status != OK)
break;
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);
}
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;
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");
if (write (fd1, buffer, i) != i) {
you_lose:
close (fd1);
- unlink (tmpfil);
+ (void) m_unlink (tmpfil);
return -1;
}
if (i == -1)
}
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;
}
#else /* ! READLINE_SUPPORT */
if (!(argp = getans (prompt, aleqs))) {
#endif /* READLINE_SUPPORT */
- unlink (LINK);
+ (void) m_unlink (LINK);
done (1);
}
switch (smatch (*argp, aleqs)) {
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;
&& 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);
}
*ed = NULL;
if (altmsg && atfile)
- unlink (linkpath);
+ (void) m_unlink (linkpath);
return status;
}
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 {
static int
removefile (char *drft)
{
- if (unlink (drft) == NOTOK)
+ if (m_unlink (drft) == NOTOK)
adios (drft, "unable to unlink");
return OK;
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);