Date: Thu, 23 Mar 2017 04:50:44 +0000 (UTC) From: Ngie Cooper <ngie@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r315785 - stable/11/lib/libkvm Message-ID: <201703230450.v2N4oiG1006365@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ngie Date: Thu Mar 23 04:50:44 2017 New Revision: 315785 URL: https://svnweb.freebsd.org/changeset/base/315785 Log: 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. Modified: stable/11/lib/libkvm/kvm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libkvm/kvm.c ============================================================================== --- stable/11/lib/libkvm/kvm.c Thu Mar 23 04:50:38 2017 (r315784) +++ stable/11/lib/libkvm/kvm.c Thu Mar 23 04:50:44 2017 (r315785) @@ -479,7 +479,7 @@ failed: if (errout != NULL) strlcpy(errout, kd->errbuf, _POSIX2_LINE_MAX); (void)kvm_close(kd); - return (0); + return (NULL); } kvm_t * @@ -492,7 +492,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)); } @@ -507,7 +507,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)); @@ -523,7 +523,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?201703230450.v2N4oiG1006365>