From owner-svn-src-stable@FreeBSD.ORG Thu Dec 20 18:13:05 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 560A575E; Thu, 20 Dec 2012 18:13:05 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3A4C48FC0A; Thu, 20 Dec 2012 18:13:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBKID5M6096393; Thu, 20 Dec 2012 18:13:05 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBKID5h2096392; Thu, 20 Dec 2012 18:13:05 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201212201813.qBKID5h2096392@svn.freebsd.org> From: Eitan Adler Date: Thu, 20 Dec 2012 18:13:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r244497 - stable/8/usr.bin/fetch X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2012 18:13:05 -0000 Author: eadler Date: Thu Dec 20 18:13:04 2012 New Revision: 244497 URL: http://svnweb.freebsd.org/changeset/base/244497 Log: MFC r244037: Add check for failure of mkstemp and setenv. Approved by: cperciva (implicit) Modified: stable/8/usr.bin/fetch/fetch.c Directory Properties: stable/8/usr.bin/fetch/ (props changed) Modified: stable/8/usr.bin/fetch/fetch.c ============================================================================== --- stable/8/usr.bin/fetch/fetch.c Thu Dec 20 18:12:40 2012 (r244496) +++ stable/8/usr.bin/fetch/fetch.c Thu Dec 20 18:13:04 2012 (r244497) @@ -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)