From owner-svn-src-all@freebsd.org Fri Apr 15 03:38:59 2016 Return-Path: Delivered-To: svn-src-all@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 63022AED235; Fri, 15 Apr 2016 03:38:59 +0000 (UTC) (envelope-from araujo@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 2509616AA; Fri, 15 Apr 2016 03:38:59 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3F3cw9i056568; Fri, 15 Apr 2016 03:38:58 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3F3cwgQ056567; Fri, 15 Apr 2016 03:38:58 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201604150338.u3F3cwgQ056567@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Fri, 15 Apr 2016 03:38:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r298028 - head/usr.sbin/fmtree X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Apr 2016 03:38:59 -0000 Author: araujo Date: Fri Apr 15 03:38:58 2016 New Revision: 298028 URL: https://svnweb.freebsd.org/changeset/base/298028 Log: Use NULL instead of 0 for pointers. fopen(3) returns NULL in case it can't open the STREAM. fgetln(3) returns NULL if it can't get a line from a STREAM. malloc returns NULL if it can't allocate memory. Modified: head/usr.sbin/fmtree/excludes.c Modified: head/usr.sbin/fmtree/excludes.c ============================================================================== --- head/usr.sbin/fmtree/excludes.c Fri Apr 15 03:10:04 2016 (r298027) +++ head/usr.sbin/fmtree/excludes.c Fri Apr 15 03:38:58 2016 (r298028) @@ -69,10 +69,10 @@ read_excludes_file(const char *name) size_t len; fp = fopen(name, "r"); - if (fp == 0) + if (fp == NULL) err(1, "%s", name); - while ((line = fgetln(fp, &len)) != 0) { + while ((line = fgetln(fp, &len)) != NULL) { if (line[len - 1] == '\n') len--; if (len == 0) @@ -80,7 +80,7 @@ read_excludes_file(const char *name) str = malloc(len + 1); e = malloc(sizeof *e); - if (str == 0 || e == 0) + if (str == NULL || e == NULL) errx(1, "memory allocation error"); e->glob = str; memcpy(str, line, len);