svn commit: r315787 - stable/10/lib/libkvm

Ngie Cooper ngie at FreeBSD.org
Thu Mar 23 04:54:33 UTC 2017


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));


More information about the svn-src-all mailing list