From d1f2475cde09ec71c1e3ea1d3d8efd347cf526d4 Mon Sep 17 00:00:00 2001 From: trociny Date: Sun, 26 May 2013 18:26:29 +0000 Subject: [PATCH] MFC r250147: procstat_getpathname: for kvm method, instead of returning the error that the method is not supported, return an empty string. This looks more handy for callers like procstat(1), which will not abort after the failed call and still output some useful information. git-svn-id: svn://svn.freebsd.org/base/stable/9@251003 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- lib/libprocstat/libprocstat.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/libprocstat/libprocstat.c b/lib/libprocstat/libprocstat.c index b1f581c5b..6ec18b15b 100644 --- a/lib/libprocstat/libprocstat.c +++ b/lib/libprocstat/libprocstat.c @@ -2120,8 +2120,10 @@ procstat_getpathname(struct procstat *procstat, struct kinfo_proc *kp, { switch(procstat->type) { case PROCSTAT_KVM: - warnx("kvm method is not supported"); - return (-1); + /* XXX: Return empty string. */ + if (maxlen > 0) + pathname[0] = '\0'; + return (0); case PROCSTAT_SYSCTL: return (procstat_getpathname_sysctl(kp->ki_pid, pathname, maxlen)); -- 2.45.0