HomeFreeBSD

crunchgen: use realpath(3) instead of ``pwd -P''

Description

crunchgen: use realpath(3) instead of ``pwd -P''

r366466 (9c7bd4f198e1) fixed a subtle bug by stripping the trailing
'\n' appended to the output of popen("cd %s && pwd -P", p->srcdir).

Replace this cumbersome implementation with a single realpath(3) call
which avoids spawning a shell, reading from the stream with fgets(3),
and final strdup(3).

Reviewed by: arichardson, kevans
Approved by: imp
Differential Revision: https://reviews.freebsd.org/D26734

Details

Provenance
danfeAuthored on Oct 11 2020, 8:23 AM
Reviewer
arichardson
Differential Revision
D26734: crunchgen: replace "cd p->srcdir && pwd -P" with realpath(p->srcdir)
Parents
rG70de1003da6f: jail(8): Fix a few common typos in source code comments
Branches
Unknown
Tags
Unknown