-/* $OpenBSD: quit.c,v 1.22 2015/11/11 01:12:10 deraadt Exp $ */
+/* $OpenBSD: quit.c,v 1.23 2016/07/19 06:43:27 deraadt Exp $ */
/* $NetBSD: quit.c,v 1.6 1996/12/28 07:11:07 tls Exp $ */
/*
mbox = expand("&");
mcount = c;
if (value("append") == NULL) {
+ int fdx;
+
(void)snprintf(tempname, sizeof(tempname),
"%s/mail.RmXXXXXXXXXX", tmpdir);
if ((fd = mkstemp(tempname)) == -1 ||
return(-1);
}
(void)Fclose(obuf);
- (void)close(open(mbox, O_CREAT | O_TRUNC | O_WRONLY, 0600));
+ if ((fdx = open(mbox, O_CREAT | O_TRUNC | O_WRONLY, 0600)) != -1)
+ close(fdx);
if ((obuf = Fopen(mbox, "r+")) == NULL) {
warn("%s", mbox);
(void)Fclose(ibuf);
-/* $OpenBSD: v7.local.c,v 1.16 2015/11/11 01:12:10 deraadt Exp $ */
+/* $OpenBSD: v7.local.c,v 1.17 2016/07/19 06:43:27 deraadt Exp $ */
/* $NetBSD: v7.local.c,v 1.8 1997/05/13 06:15:58 mikel Exp $ */
/*
void
demail(void)
{
+ int fd;
- if (value("keep") != NULL || rm(mailname) < 0)
- (void)close(open(mailname, O_CREAT | O_TRUNC | O_WRONLY, 0600));
+ if (value("keep") != NULL || rm(mailname) < 0) {
+ fd = open(mailname, O_CREAT | O_TRUNC | O_WRONLY, 0600);
+ if (fd != -1)
+ close(fd);
+ }
}
/*
-/* $OpenBSD: inp.c,v 1.45 2015/11/11 01:12:10 deraadt Exp $ */
+/* $OpenBSD: inp.c,v 1.46 2016/07/19 06:43:27 deraadt Exp $ */
/*
* patch - a program to apply diffs to original files
statfailed = stat(filename, &filestat);
if (statfailed && ok_to_create_file) {
+ int fd;
+
if (verbose)
say("(Creating file %s...)\n", filename);
if (check_only)
return true;
makedirs(filename, true);
- close(open(filename, O_CREAT | O_TRUNC | O_WRONLY, 0666));
+ if ((fd = open(filename, O_CREAT | O_TRUNC | O_WRONLY, 0666)) != -1)
+ close(fd);
+
statfailed = stat(filename, &filestat);
}
if (statfailed)