Date: Thu, 23 Mar 2017 04:54:32 +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-10@freebsd.org Subject: svn commit: r315787 - stable/10/lib/libkvm Message-ID: <201703230454.v2N4sWxx010410@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ngie Date: Thu Mar 23 04:54:31 2017 New Revision: 315787 URL: https://svnweb.freebsd.org/changeset/base/315787 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/10/lib/libkvm/kvm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libkvm/kvm.c ============================================================================== --- stable/10/lib/libkvm/kvm.c Thu Mar 23 04:50:50 2017 (r315786) +++ stable/10/lib/libkvm/kvm.c Thu Mar 23 04:54:31 2017 (r315787) @@ -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 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, 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));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703230454.v2N4sWxx010410>