Created attachment 193626 [details]
patch fixing the issue
`man 3 sysctl` states: "If the amount of data available is greater than the size of the buffer supplied, the call supplies as much data as fits in the buffer provided and returns with the error code ENOMEM."
This is not true in the case of `KERN_PROC_CWD`, in which case `sysctl` returns 0, indicating success.
I think this change is right. Note that export_kinfo_to_sb() is used in other contexts, but in most of them the return value isn't checked anyway.
I also meant to point out that we don't seem to have any applications relying on the current behaviour, which seems to have been introduced relatively recently: r249487.
This is my first patch to FreeBSD so forgive my ignorance -- what are the next steps? Can you land the change for me Mark? Or do I need to find someone else to review it, and if so who?
(In reply to Brennan Vincent from comment #3)
I'll take care of getting it reviewed and committed.
Ping: Mark, is there any good reason your fix in D15607 never landed?
(In reply to Brennan Vincent from comment #6)
I thought I had found some problem with the patch, but didn't have time to revisit it and it slipped from my todo list. I'll revisit it shortly, apologies for the delay.