From owner-svn-src-all@freebsd.org Fri Apr 15 02:14:12 2016 Return-Path: <owner-svn-src-all@freebsd.org> 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 E0240AED3BB; Fri, 15 Apr 2016 02:14:12 +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 AFE811FDA; Fri, 15 Apr 2016 02:14:12 +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 u3F2EBYu031846; Fri, 15 Apr 2016 02:14:11 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3F2EBBX031845; Fri, 15 Apr 2016 02:14:11 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201604150214.u3F2EBBX031845@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo <araujo@FreeBSD.org> Date: Fri, 15 Apr 2016 02:14:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r298021 - head/usr.sbin/fdformat 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" \)" <svn-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-all>, <mailto:svn-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-all/> List-Post: <mailto:svn-src-all@freebsd.org> List-Help: <mailto:svn-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-all>, <mailto:svn-src-all-request@freebsd.org?subject=subscribe> X-List-Received-Date: Fri, 15 Apr 2016 02:14:13 -0000 Author: araujo Date: Fri Apr 15 02:14:11 2016 New Revision: 298021 URL: https://svnweb.freebsd.org/changeset/base/298021 Log: Use NULL instead of 0 for pointers and memory allocation. malloc and realloc will return NULL pointer if it can't alloc memory. MFC after: 4 weeks Modified: head/usr.sbin/fdformat/fdformat.c Modified: head/usr.sbin/fdformat/fdformat.c ============================================================================== --- head/usr.sbin/fdformat/fdformat.c Fri Apr 15 01:45:05 2016 (r298020) +++ head/usr.sbin/fdformat/fdformat.c Fri Apr 15 02:14:11 2016 (r298021) @@ -95,7 +95,7 @@ verify_track(int fd, int track, int trac if (bufsz < tracksize) buf = realloc(buf, bufsz = tracksize); - if (buf == 0) + if (buf == NULL) errx(EX_UNAVAILABLE, "out of memory"); if (lseek (fd, (long) track * tracksize, 0) < 0) rv = -1; @@ -205,7 +205,7 @@ main(int argc, char **argv) if (stat(argv[optind], &sb) == -1 && errno == ENOENT) { /* try prepending _PATH_DEV */ device = malloc(strlen(argv[optind]) + sizeof(_PATH_DEV) + 1); - if (device == 0) + if (device == NULL) errx(EX_UNAVAILABLE, "out of memory"); strcpy(device, _PATH_DEV); strcat(device, argv[optind]); @@ -252,7 +252,7 @@ main(int argc, char **argv) if (format) { getname(type, &name, &descr); fdtp = get_fmt(format, type); - if (fdtp == 0) + if (fdtp == NULL) errx(EX_USAGE, "unknown format %d KB for drive type %s", format, name);