Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
I think the new version may actually be wrong. Shouldn't it be PATH_MAX+1? That said, what's the motivation for changing this?
Comment Actions
I actually think PATH_MAX/MAXPATHLEN is correct. Otherwise it s just simplifying it.
Comment Actions
I don't personally know, but the one example I came across online is using +1.
https://common-lisp.net/~alendvai/darcs/sbcl/src/runtime/bsd-os.c
Search the page for the function os_get_runtime_executable_path. Let's see what @emaste has to say.
Comment Actions
From sysctl_kern_proc_pathname:
error = vn_fullpath(req->td, vp, &retbuf, &freebuf);
vrele(vp);
if (error)
return (error);
error = SYSCTL_OUT(req, retbuf, strlen(retbuf) + 1);and in vn_fullpath:
buf = malloc(MAXPATHLEN, M_TEMP, M_WAITOK);
So the pathname, including the '\0' fits in MAXPATHLEN/PATH_MAX.