diff options
author | araujo <araujo@FreeBSD.org> | 2016-04-15 03:38:58 +0000 |
---|---|---|
committer | araujo <araujo@FreeBSD.org> | 2016-04-15 03:38:58 +0000 |
commit | de393d2ab18de0224c30483ed700a7388058f4e9 (patch) | |
tree | d69ab628f150cc6ea4210810bf97ce25e785d25a /usr.sbin/fmtree | |
parent | 67c9da0828a05e0891ba112692341f2ea716ee63 (diff) | |
download | FreeBSD-src-de393d2ab18de0224c30483ed700a7388058f4e9.zip FreeBSD-src-de393d2ab18de0224c30483ed700a7388058f4e9.tar.gz |
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.
Diffstat (limited to 'usr.sbin/fmtree')
-rw-r--r-- | usr.sbin/fmtree/excludes.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/fmtree/excludes.c b/usr.sbin/fmtree/excludes.c index 21a49b0..9f1c564 100644 --- a/usr.sbin/fmtree/excludes.c +++ b/usr.sbin/fmtree/excludes.c @@ -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); |