aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/fdformat
diff options
context:
space:
mode:
authorMarcelo Araujo <araujo@FreeBSD.org>2016-04-15 02:14:11 +0000
committerMarcelo Araujo <araujo@FreeBSD.org>2016-04-15 02:14:11 +0000
commit960536b69fcc255b15815acbae7cdc1b9cac3013 (patch)
tree125d6a892ed8924d047079e7c3479913f80a273f /usr.sbin/fdformat
parent69f23055872370098a1d7a9a7bd8804146698d66 (diff)
downloadsrc-960536b69fcc255b15815acbae7cdc1b9cac3013.tar.gz
src-960536b69fcc255b15815acbae7cdc1b9cac3013.zip
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
Notes
Notes: svn path=/head/; revision=298021
Diffstat (limited to 'usr.sbin/fdformat')
-rw-r--r--usr.sbin/fdformat/fdformat.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/fdformat/fdformat.c b/usr.sbin/fdformat/fdformat.c
index 341a161d1831..b7bab867951d 100644
--- a/usr.sbin/fdformat/fdformat.c
+++ b/usr.sbin/fdformat/fdformat.c
@@ -95,7 +95,7 @@ verify_track(int fd, int track, int tracksize)
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);