From 28047d83f058e3d971c5648584bc2a593fa7753d Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Thu, 16 Mar 2017 02:31:42 +0000 Subject: [PATCH] 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. MFC after: 1 week Sponsored by: Dell EMC Isilon --- lib/libkvm/kvm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/libkvm/kvm.c b/lib/libkvm/kvm.c index a9126de6efd2..a08c6bda94e7 100644 --- a/lib/libkvm/kvm.c +++ b/lib/libkvm/kvm.c @@ -217,7 +217,7 @@ _kvm_open(kvm_t *kd, const char *uf, const char *mf, int flag, char *errout) if (errout != NULL) strlcpy(errout, kd->errbuf, _POSIX2_LINE_MAX); (void)kvm_close(kd); - return (0); + return (NULL); } kvm_t * @@ -230,7 +230,7 @@ kvm_openfiles(const char *uf, const char *mf, const char *sf __unused, int flag, if (errout != NULL) (void)strlcpy(errout, strerror(errno), _POSIX2_LINE_MAX); - return (0); + return (NULL); } return (_kvm_open(kd, uf, mf, flag, errout)); } @@ -245,7 +245,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)); @@ -261,7 +261,7 @@ kvm_open2(const char *uf, const char *mf, int flag, char *errout, if (errout != NULL) (void)strlcpy(errout, strerror(errno), _POSIX2_LINE_MAX); - return (0); + return (NULL); } kd->resolve_symbol = resolver; return (_kvm_open(kd, uf, mf, flag, errout));