Date: Thu, 20 Dec 2012 18:13:05 +0000 (UTC) From: Eitan Adler <eadler@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r244498 - stable/7/usr.bin/fetch Message-ID: <201212201813.qBKID5oZ096401@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: eadler Date: Thu Dec 20 18:13:04 2012 New Revision: 244498 URL: http://svnweb.freebsd.org/changeset/base/244498 Log: MFC r244037: Add check for failure of mkstemp and setenv. Approved by: cperciva (implicit) Modified: stable/7/usr.bin/fetch/fetch.c Directory Properties: stable/7/usr.bin/fetch/ (props changed) Modified: stable/7/usr.bin/fetch/fetch.c ============================================================================== --- stable/7/usr.bin/fetch/fetch.c Thu Dec 20 18:13:04 2012 (r244497) +++ stable/7/usr.bin/fetch/fetch.c Thu Dec 20 18:13:04 2012 (r244498) @@ -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); @@ -969,7 +972,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?201212201813.qBKID5oZ096401>