Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/mail Only open regular files.
details: https://anonhg.NetBSD.org/src/rev/8d71c07f9e49
branches: trunk
changeset: 357405:8d71c07f9e49
user: christos <christos%NetBSD.org@localhost>
date: Thu Nov 09 20:27:50 2017 +0000
description:
Only open regular files.
diffstat:
usr.bin/mail/cmd2.c | 6 +++---
usr.bin/mail/cmd3.c | 6 +++---
usr.bin/mail/collect.c | 10 +++++-----
usr.bin/mail/edit.c | 8 ++++----
usr.bin/mail/fio.c | 6 +++---
usr.bin/mail/lex.c | 14 +++++++-------
usr.bin/mail/list.c | 6 +++---
usr.bin/mail/mime_attach.c | 20 ++++++++++----------
usr.bin/mail/mime_child.c | 8 ++++----
usr.bin/mail/mime_detach.c | 8 ++++----
usr.bin/mail/names.c | 10 +++++-----
usr.bin/mail/quit.c | 36 ++++++++++++++++++------------------
usr.bin/mail/send.c | 10 +++++-----
usr.bin/mail/support.c | 8 ++++----
14 files changed, 78 insertions(+), 78 deletions(-)
diffs (truncated from 693 to 300 lines):
diff -r 44a6bd71cb63 -r 8d71c07f9e49 usr.bin/mail/cmd2.c
--- a/usr.bin/mail/cmd2.c Thu Nov 09 19:34:17 2017 +0000
+++ b/usr.bin/mail/cmd2.c Thu Nov 09 20:27:50 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cmd2.c,v 1.25 2012/04/29 23:50:22 christos Exp $ */
+/* $NetBSD: cmd2.c,v 1.26 2017/11/09 20:27:50 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)cmd2.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: cmd2.c,v 1.25 2012/04/29 23:50:22 christos Exp $");
+__RCSID("$NetBSD: cmd2.c,v 1.26 2017/11/09 20:27:50 christos Exp $");
#endif
#endif /* not lint */
@@ -230,7 +230,7 @@
disp = "[Appended]";
else
disp = "[New file]";
- if ((obuf = Fopen(fn, "ae")) == NULL) {
+ if ((obuf = Fopen(fn, "aef")) == NULL) {
warn(NULL);
return 1;
}
diff -r 44a6bd71cb63 -r 8d71c07f9e49 usr.bin/mail/cmd3.c
--- a/usr.bin/mail/cmd3.c Thu Nov 09 19:34:17 2017 +0000
+++ b/usr.bin/mail/cmd3.c Thu Nov 09 20:27:50 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cmd3.c,v 1.43 2014/12/16 19:30:24 christos Exp $ */
+/* $NetBSD: cmd3.c,v 1.44 2017/11/09 20:27:50 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)cmd3.c 8.2 (Berkeley) 4/20/95";
#else
-__RCSID("$NetBSD: cmd3.c,v 1.43 2014/12/16 19:30:24 christos Exp $");
+__RCSID("$NetBSD: cmd3.c,v 1.44 2017/11/09 20:27:50 christos Exp $");
#endif
#endif /* not lint */
@@ -501,7 +501,7 @@
(void)snprintf(mailtempname, sizeof(mailtempname),
"%s/mail.RsXXXXXXXXXX", tmpdir);
if ((fd = mkstemp(mailtempname)) == -1 ||
- (obuf = Fdopen(fd, "we+")) == NULL) {
+ (obuf = Fdopen(fd, "wef+")) == NULL) {
if (fd != -1)
(void)close(fd);
warn("%s", mailtempname);
diff -r 44a6bd71cb63 -r 8d71c07f9e49 usr.bin/mail/collect.c
--- a/usr.bin/mail/collect.c Thu Nov 09 19:34:17 2017 +0000
+++ b/usr.bin/mail/collect.c Thu Nov 09 20:27:50 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: collect.c,v 1.48 2017/05/02 03:29:14 christos Exp $ */
+/* $NetBSD: collect.c,v 1.49 2017/11/09 20:27:50 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)collect.c 8.2 (Berkeley) 4/19/94";
#else
-__RCSID("$NetBSD: collect.c,v 1.48 2017/05/02 03:29:14 christos Exp $");
+__RCSID("$NetBSD: collect.c,v 1.49 2017/11/09 20:27:50 christos Exp $");
#endif
#endif /* not lint */
@@ -165,7 +165,7 @@
(void)snprintf(tempname, sizeof(tempname),
"%s/mail.ReXXXXXXXXXX", tmpdir);
if ((fd = mkstemp(tempname)) == -1 ||
- (nf = Fdopen(fd, "we+")) == NULL) {
+ (nf = Fdopen(fd, "wef+")) == NULL) {
if (fd != -1)
(void)close(fd);
warn("%s", tempname);
@@ -403,7 +403,7 @@
(void)snprintf(mailtempname, sizeof(mailtempname),
"%s/mail.RsXXXXXXXXXX", tmpdir);
if ((fd = mkstemp(mailtempname)) == -1 ||
- (collf = Fdopen(fd, "we+")) == NULL) {
+ (collf = Fdopen(fd, "wef+")) == NULL) {
if (fd != -1)
(void)close(fd);
warn("%s", mailtempname);
@@ -634,7 +634,7 @@
(void)snprintf(tempname, sizeof(tempname),
"%s/mail.ReXXXXXXXXXX", tmpdir);
if ((fd = mkstemp(tempname)) == -1 ||
- (fbuf = Fdopen(fd, "we+")) == NULL) {
+ (fbuf = Fdopen(fd, "wef+")) == NULL) {
if (fd != -1)
(void)close(fd);
warn("%s", tempname);
diff -r 44a6bd71cb63 -r 8d71c07f9e49 usr.bin/mail/edit.c
--- a/usr.bin/mail/edit.c Thu Nov 09 19:34:17 2017 +0000
+++ b/usr.bin/mail/edit.c Thu Nov 09 20:27:50 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: edit.c,v 1.28 2016/02/03 05:18:58 christos Exp $ */
+/* $NetBSD: edit.c,v 1.29 2017/11/09 20:27:50 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)edit.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: edit.c,v 1.28 2016/02/03 05:18:58 christos Exp $");
+__RCSID("$NetBSD: edit.c,v 1.29 2017/11/09 20:27:50 christos Exp $");
#endif
#endif /* not lint */
@@ -77,7 +77,7 @@
(void)unlink(tempname);
goto out;
}
- if ((nf = Fdopen(t, "we")) == NULL) {
+ if ((nf = Fdopen(t, "wef")) == NULL) {
(void)close(t);
warn("%s", tempname);
(void)unlink(tempname);
@@ -134,7 +134,7 @@
/*
* Now switch to new file.
*/
- if ((nf = Fopen(tempname, "ae+")) == NULL) {
+ if ((nf = Fopen(tempname, "aef+")) == NULL) {
warn("%s", tempname);
(void)unlink(tempname);
goto out;
diff -r 44a6bd71cb63 -r 8d71c07f9e49 usr.bin/mail/fio.c
--- a/usr.bin/mail/fio.c Thu Nov 09 19:34:17 2017 +0000
+++ b/usr.bin/mail/fio.c Thu Nov 09 20:27:50 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fio.c,v 1.42 2015/01/10 17:16:01 christos Exp $ */
+/* $NetBSD: fio.c,v 1.43 2017/11/09 20:27:50 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)fio.c 8.2 (Berkeley) 4/20/95";
#else
-__RCSID("$NetBSD: fio.c,v 1.42 2015/01/10 17:16:01 christos Exp $");
+__RCSID("$NetBSD: fio.c,v 1.43 2017/11/09 20:27:50 christos Exp $");
#endif
#endif /* not lint */
@@ -190,7 +190,7 @@
/* Get temporary file. */
(void)snprintf(linebuf, LINESIZE, "%s/mail.XXXXXX", tmpdir);
if ((c = mkstemp(linebuf)) == -1 ||
- (mestmp = Fdopen(c, "re+")) == NULL) {
+ (mestmp = Fdopen(c, "ref+")) == NULL) {
(void)fprintf(stderr, "mail: can't open %s\n", linebuf);
exit(1);
}
diff -r 44a6bd71cb63 -r 8d71c07f9e49 usr.bin/mail/lex.c
--- a/usr.bin/mail/lex.c Thu Nov 09 19:34:17 2017 +0000
+++ b/usr.bin/mail/lex.c Thu Nov 09 20:27:50 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.43 2013/02/20 14:38:13 christos Exp $ */
+/* $NetBSD: lex.c,v 1.44 2017/11/09 20:27:50 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)lex.c 8.2 (Berkeley) 4/20/95";
#else
-__RCSID("$NetBSD: lex.c,v 1.43 2013/02/20 14:38:13 christos Exp $");
+__RCSID("$NetBSD: lex.c,v 1.44 2017/11/09 20:27:50 christos Exp $");
#endif
#endif /* not lint */
@@ -214,7 +214,7 @@
if ((name = expand(name)) == NULL)
return -1;
- if ((ibuf = Fopen(name, "re")) == NULL) {
+ if ((ibuf = Fopen(name, "ref")) == NULL) {
if (!isedit && errno == ENOENT)
goto nomail;
warn("Can't open `%s'", name);
@@ -278,9 +278,9 @@
(void)snprintf(tempname, sizeof(tempname),
"%s/mail.RxXXXXXXXXXX", tmpdir);
if ((fd = mkstemp(tempname)) == -1 ||
- (otf = fdopen(fd, "we")) == NULL)
+ (otf = fdopen(fd, "wef")) == NULL)
err(EXIT_FAILURE, "Can't create tmp file `%s'", tempname);
- if ((itf = fopen(tempname, "re")) == NULL)
+ if ((itf = fopen(tempname, "ref")) == NULL)
err(EXIT_FAILURE, "Can't create tmp file `%s'", tempname);
(void)rm(tempname);
setptr(ibuf, (off_t)0);
@@ -317,7 +317,7 @@
omsgCount = get_abs_msgCount();
- ibuf = Fopen(mailname, "re");
+ ibuf = Fopen(mailname, "ref");
if (ibuf == NULL)
return -1;
sig_check();
@@ -1121,7 +1121,7 @@
{
FILE *in, *oldin;
- if ((in = Fopen(name, "re")) == NULL)
+ if ((in = Fopen(name, "ref")) == NULL)
return;
oldin = input;
input = in;
diff -r 44a6bd71cb63 -r 8d71c07f9e49 usr.bin/mail/list.c
--- a/usr.bin/mail/list.c Thu Nov 09 19:34:17 2017 +0000
+++ b/usr.bin/mail/list.c Thu Nov 09 20:27:50 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: list.c,v 1.27 2012/04/29 23:50:22 christos Exp $ */
+/* $NetBSD: list.c,v 1.28 2017/11/09 20:27:50 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)list.c 8.4 (Berkeley) 5/1/95";
#else
-__RCSID("$NetBSD: list.c,v 1.27 2012/04/29 23:50:22 christos Exp $");
+__RCSID("$NetBSD: list.c,v 1.28 2017/11/09 20:27:50 christos Exp $");
#endif
#endif /* not lint */
@@ -626,7 +626,7 @@
fp = NULL;
if ((fd = mkstemp(tempname)) != -1) {
(void)unlink(tempname);
- if ((fp = Fdopen(fd, "we+")) == NULL)
+ if ((fp = Fdopen(fd, "wef+")) == NULL)
(void)close(fd);
}
if (fp == NULL) {
diff -r 44a6bd71cb63 -r 8d71c07f9e49 usr.bin/mail/mime_attach.c
--- a/usr.bin/mail/mime_attach.c Thu Nov 09 19:34:17 2017 +0000
+++ b/usr.bin/mail/mime_attach.c Thu Nov 09 20:27:50 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mime_attach.c,v 1.18 2015/06/17 00:03:42 christos Exp $ */
+/* $NetBSD: mime_attach.c,v 1.19 2017/11/09 20:27:50 christos Exp $ */
/*-
* Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
#include <sys/cdefs.h>
#ifndef __lint__
-__RCSID("$NetBSD: mime_attach.c,v 1.18 2015/06/17 00:03:42 christos Exp $");
+__RCSID("$NetBSD: mime_attach.c,v 1.19 2017/11/09 20:27:50 christos Exp $");
#endif /* not __lint__ */
#include <assert.h>
@@ -273,7 +273,7 @@
{
FILE *fp;
const char *enc;
- fp = Fopen(filename, "re");
+ fp = Fopen(filename, "ref");
if (fp == NULL) {
warn("content_encoding_by_name: %s", filename);
return MIME_TRANSFER_BASE64; /* safe */
@@ -293,7 +293,7 @@
cur_pos = lseek(fd, (off_t)0, SEEK_CUR);
if ((fd2 = dup(fd)) == -1 ||
- (fp = Fdopen(fd2, "re")) == NULL) {
+ (fp = Fdopen(fd2, "ref")) == NULL) {
warn("content_encoding_by_fileno");
if (fd2 != -1)
(void)close(fd2);
@@ -356,7 +356,7 @@
int ch;
if (sb.st_size == 0 || filename == NULL ||
- (fp = Fopen(filename, "re")) == NULL)
+ (fp = Fopen(filename, "ref")) == NULL)
return "text/plain";
ch = fgetc(fp);
@@ -545,7 +545,7 @@
switch (ap->a_type) {
case ATTACH_FNAME:
- fi = Fopen(ap->a_name, "re");
+ fi = Fopen(ap->a_name, "ref");
if (fi == NULL)
err(EXIT_FAILURE, "Fopen: %s", ap->a_name);
break;
Home |
Main Index |
Thread Index |
Old Index