From owner-svn-src-head@freebsd.org Wed Apr 12 19:23:42 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F286DD3B746; Wed, 12 Apr 2017 19:23:42 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 C29E7295; Wed, 12 Apr 2017 19:23:42 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3CJNfFN098470; Wed, 12 Apr 2017 19:23:41 GMT (envelope-from sobomax@FreeBSD.org) Received: (from sobomax@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3CJNf6i098469; Wed, 12 Apr 2017 19:23:41 GMT (envelope-from sobomax@FreeBSD.org) Message-Id: <201704121923.v3CJNf6i098469@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sobomax set sender to sobomax@FreeBSD.org using -f From: Maxim Sobolev Date: Wed, 12 Apr 2017 19:23:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r316738 - head/sbin/mksnap_ffs 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.23 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, 12 Apr 2017 19:23:43 -0000 Author: sobomax Date: Wed Apr 12 19:23:41 2017 New Revision: 316738 URL: https://svnweb.freebsd.org/changeset/base/316738 Log: Fix an issue in the rev.316718 causing variable to be unsed uninitialized. Reported by: Coverity Nudged by: cem MFC after: 2 weeks Modified: head/sbin/mksnap_ffs/mksnap_ffs.c Modified: head/sbin/mksnap_ffs/mksnap_ffs.c ============================================================================== --- head/sbin/mksnap_ffs/mksnap_ffs.c Wed Apr 12 18:52:06 2017 (r316737) +++ head/sbin/mksnap_ffs/mksnap_ffs.c Wed Apr 12 19:23:41 2017 (r316738) @@ -59,13 +59,12 @@ usage(void) } static int -isdir(const char *path) +isdir(const char *path, struct stat *stbufp) { - struct stat stbuf; - if (stat(path, &stbuf) < 0) + if (stat(path, stbufp) < 0) return (-1); - if (!S_ISDIR(stbuf.st_mode)) + if (!S_ISDIR(stbufp->st_mode)) return (0); return (1); } @@ -74,8 +73,9 @@ static int issamefs(const char *path, struct statfs *stfsp) { struct statfs stfsbuf; + struct stat stbuf; - if (isdir(path) != 1) + if (isdir(path, &stbuf) != 1) return (-1); if (statfs(path, &stfsbuf) < 0) return (-1); @@ -123,7 +123,7 @@ main(int argc, char **argv) } if (statfs(path, &stfsbuf) < 0) err(1, "%s", path); - switch (isdir(path)) { + switch (isdir(path, &stbuf)) { case -1: err(1, "%s", path); case 0: