From owner-svn-src-head@FreeBSD.ORG Wed Sep 17 19:09:58 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AA16A3E9; Wed, 17 Sep 2014 19:09:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 95432A89; Wed, 17 Sep 2014 19:09:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8HJ9w9T017142; Wed, 17 Sep 2014 19:09:58 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8HJ9wgv017141; Wed, 17 Sep 2014 19:09:58 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201409171909.s8HJ9wgv017141@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 17 Sep 2014 19:09:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r271720 - head/sbin/savecore X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Sep 2014 19:09:58 -0000 Author: bdrewery Date: Wed Sep 17 19:09:58 2014 New Revision: 271720 URL: http://svnweb.freebsd.org/changeset/base/271720 Log: If fgets(3) fails in getbounds(), show strerror(3) if not an EOF. Also fix a FILE* leak in getbounds(). Submitted by: Conrad Meyer PR: 192032 Sponsored by: EMC / Isilon Storage Division MFC after: 1 week Modified: head/sbin/savecore/savecore.c Modified: head/sbin/savecore/savecore.c ============================================================================== --- head/sbin/savecore/savecore.c Wed Sep 17 19:01:22 2014 (r271719) +++ head/sbin/savecore/savecore.c Wed Sep 17 19:09:58 2014 (r271720) @@ -151,7 +151,10 @@ getbounds(void) { } if (fgets(buf, sizeof buf, fp) == NULL) { - syslog(LOG_WARNING, "unable to read from bounds, using 0"); + if (feof(fp)) + syslog(LOG_WARNING, "bounds file is empty, using 0"); + else + syslog(LOG_WARNING, "bounds file: %s", strerror(errno)); fclose(fp); return (ret); } @@ -160,6 +163,7 @@ getbounds(void) { ret = (int)strtol(buf, NULL, 10); if (ret == 0 && (errno == EINVAL || errno == ERANGE)) syslog(LOG_WARNING, "invalid value found in bounds, using 0"); + fclose(fp); return (ret); }