diff options
author | ngie <ngie@FreeBSD.org> | 2017-03-23 04:54:31 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2017-03-23 04:54:31 +0000 |
commit | 5fa09ded41ed211c33fe2c12b81f13fc03f1c1b8 (patch) | |
tree | 6bf5ab545a5fcf8b5bc1ff8ac7e64846e36e7f09 /lib | |
parent | 950518ba26fdc1656b1e5ea21c09e311ce69b0c0 (diff) | |
download | FreeBSD-src-5fa09ded41ed211c33fe2c12b81f13fc03f1c1b8.zip FreeBSD-src-5fa09ded41ed211c33fe2c12b81f13fc03f1c1b8.tar.gz |
MFC r315360:
Return NULL instead of 0 on failure in _kvm_open, kvm_open{,2,files}
This is being done for the following reasons:
- kvm_open(3), etc says they will return NULL.
- NULL by definition is (void*)0 per POSIX, but can be redefined,
depending on the compiler, etc.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libkvm/kvm.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libkvm/kvm.c b/lib/libkvm/kvm.c index 85f50ad..75abcd2 100644 --- a/lib/libkvm/kvm.c +++ b/lib/libkvm/kvm.c @@ -224,7 +224,7 @@ failed: if (errout != 0) strlcpy(errout, kd->errbuf, _POSIX2_LINE_MAX); (void)kvm_close(kd); - return (0); + return (NULL); } kvm_t * @@ -235,7 +235,7 @@ kvm_openfiles(const char *uf, const char *mf, const char *sf __unused, int flag, if ((kd = calloc(1, sizeof(*kd))) == NULL) { (void)strlcpy(errout, strerror(errno), _POSIX2_LINE_MAX); - return (0); + return (NULL); } kd->program = 0; return (_kvm_open(kd, uf, mf, flag, errout)); @@ -251,7 +251,7 @@ kvm_open(const char *uf, const char *mf, const char *sf __unused, int flag, if (errstr != NULL) (void)fprintf(stderr, "%s: %s\n", errstr, strerror(errno)); - return (0); + return (NULL); } kd->program = errstr; return (_kvm_open(kd, uf, mf, flag, NULL)); |