svn commit: r356437 - head/lib/libprocstat

Mark Millard marklmi at yahoo.com
Tue Jan 7 08:39:46 UTC 2020


(Derived from O. Hartmann's report, despite his not
having the same source version, . . .)

In the code:

823	static struct filestat_list *
824	procstat_getfiles_sysctl(struct procstat *procstat, struct kinfo_proc *kp,
825	    int mmapped)
826	{
827	        struct kinfo_file *kif, *files;
. . .
841	        switch(procstat->type) {
842	        case PROCSTAT_SYSCTL:
843	                files = kinfo_getfile(kp->ki_pid, &cnt);
844	                break;
845	        case PROCSTAT_CORE:
846	                files = kinfo_getfile_core(procstat->core, &cnt);
847	                break;
848	        default:
849	                assert(!"invalid type");
850	        }
851	        if (files == NULL && errno != EPERM) {
852

for the "default:" case, if assert is disabled to
be a no-op via NDEBUG, then files would be tested
in an uninitialized state.

The compiler complaint seems valid for this.

===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)



More information about the svn-src-head mailing list