mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-20 11:11:24 +00:00
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
This commit is contained in:
parent
bb99420132
commit
28047d83f0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=315360
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user