Date: Sat, 8 Dec 2012 18:41:16 +0000 (UTC) From: Eitan Adler <eadler@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244037 - head/usr.bin/fetch Message-ID: <201212081841.qB8IfG0D094621@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: eadler Date: Sat Dec 8 18:41:16 2012 New Revision: 244037 URL: http://svnweb.freebsd.org/changeset/base/244037 Log: Add check for failure of mkstemp and setenv. Reviewed by: des Approved by: cperciva (implicit) Obtained from: DragonFlyBSD MFC after: 1 week Modified: head/usr.bin/fetch/fetch.c Modified: head/usr.bin/fetch/fetch.c ============================================================================== --- head/usr.bin/fetch/fetch.c Sat Dec 8 18:36:51 2012 (r244036) +++ head/usr.bin/fetch/fetch.c Sat Dec 8 18:41:16 2012 (r244037) @@ -618,7 +618,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); @@ -988,7 +991,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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201212081841.qB8IfG0D094621>