Date: Fri, 15 Apr 2016 02:14:11 +0000 (UTC) From: Marcelo Araujo <araujo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r298021 - head/usr.sbin/fdformat Message-ID: <201604150214.u3F2EBBX031845@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201604150214.u3F2EBBX031845>