aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/rmt/rmt.c
diff options
context:
space:
mode:
authorMarcelo Araujo <araujo@FreeBSD.org>2016-04-14 12:25:00 +0000
committerMarcelo Araujo <araujo@FreeBSD.org>2016-04-14 12:25:00 +0000
commitfa02fc2d8fde6b87d796c30d2200aec5567f4649 (patch)
treeb6217d2c8ee4d1e62751edd689a757e04625bdb2 /usr.sbin/rmt/rmt.c
parentf9e059ac831cfb7b3a312ad0de761b7f2c6cf670 (diff)
downloadsrc-fa02fc2d8fde6b87d796c30d2200aec5567f4649.tar.gz
src-fa02fc2d8fde6b87d796c30d2200aec5567f4649.zip
Use NULL instead of 0 for pointers.
fopen(3) will return NULL in case it can't open the STREAM. The malloc will return a pointer to the allocated memory if successful, otherwise a NULL pointer is returned. Also add an extra DEBUG1 to print out the error to open a file. Reviewed by: ed Differential Revision: https://svnweb.freebsd.org/changeset/base/297959
Notes
Notes: svn path=/head/; revision=297961
Diffstat (limited to 'usr.sbin/rmt/rmt.c')
-rw-r--r--usr.sbin/rmt/rmt.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.sbin/rmt/rmt.c b/usr.sbin/rmt/rmt.c
index a5c048faee2f..57c8439a70f5 100644
--- a/usr.sbin/rmt/rmt.c
+++ b/usr.sbin/rmt/rmt.c
@@ -84,8 +84,10 @@ main(int argc, char **argv)
argc--, argv++;
if (argc > 0) {
debug = fopen(*argv, "w");
- if (debug == 0)
+ if (debug == NULL) {
+ DEBUG1("rmtd: error to open %s\n", *argv);
exit(1);
+ }
(void)setbuf(debug, (char *)0);
}
top:
@@ -226,10 +228,10 @@ checkbuf(char *rec, int size)
if (size <= maxrecsize)
return (rec);
- if (rec != 0)
+ if (rec != NULL)
free(rec);
rec = malloc(size);
- if (rec == 0) {
+ if (rec == NULL) {
DEBUG("rmtd: cannot allocate buffer space\n");
exit(4);
}