aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorEitan Adler <eadler@FreeBSD.org>2012-12-20 18:13:04 +0000
committerEitan Adler <eadler@FreeBSD.org>2012-12-20 18:13:04 +0000
commit240c2c70d3edbb05a8506aa27d6ec2296cc9169c (patch)
tree43257a84aac0f41e45f02c6d87a10e8db347dee7 /usr.bin
parent5c7072b0cdb3da953577b0ba14d0dba6d6b28e1d (diff)
downloadsrc-240c2c70d3edbb05a8506aa27d6ec2296cc9169c.tar.gz
src-240c2c70d3edbb05a8506aa27d6ec2296cc9169c.zip
MFC r244037:
Add check for failure of mkstemp and setenv. Approved by: cperciva (implicit)
Notes
Notes: svn path=/stable/8/; revision=244497
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/fetch/fetch.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/fetch/fetch.c b/usr.bin/fetch/fetch.c
index e8b7318a7ffe..afa9716635b5 100644
--- a/usr.bin/fetch/fetch.c
+++ b/usr.bin/fetch/fetch.c
@@ -604,7 +604,10 @@ fetch(char *URL, const char *path)
asprintf(&tmppath, "%.*s.fetch.XXXXXX.%s",
(int)(slash - path), path, slash);
if (tmppath != NULL) {
- mkstemps(tmppath, strlen(slash) + 1);
+ if (mkstemps(tmppath, strlen(slash) + 1) == -1) {
+ warn("%s: mkstemps()", path);
+ goto failure;
+ }
of = fopen(tmppath, "w");
chown(tmppath, sb.st_uid, sb.st_gid);
chmod(tmppath, sb.st_mode & ALLPERMS);
@@ -974,7 +977,8 @@ main(int argc, char *argv[])
if (v_tty)
fetchAuthMethod = query_auth;
if (N_filename != NULL)
- setenv("NETRC", N_filename, 1);
+ if (setenv("NETRC", N_filename, 1) == -1)
+ err(1, "setenv: cannot set NETRC=%s", N_filename);
while (argc) {
if ((p = strrchr(*argv, '/')) == NULL)