Date: Thu, 16 Mar 2017 02:31:42 +0000 (UTC) From: Ngie Cooper <ngie@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r315360 - head/lib/libkvm Message-ID: <201703160231.v2G2VgxK082641@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ngie Date: Thu Mar 16 02:31:42 2017 New Revision: 315360 URL: https://svnweb.freebsd.org/changeset/base/315360 Log: 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 Modified: head/lib/libkvm/kvm.c Modified: head/lib/libkvm/kvm.c ============================================================================== --- head/lib/libkvm/kvm.c Thu Mar 16 02:09:51 2017 (r315359) +++ head/lib/libkvm/kvm.c Thu Mar 16 02:31:42 2017 (r315360) @@ -217,7 +217,7 @@ failed: 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 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, 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 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));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703160231.v2G2VgxK082641>