Page MenuHomeFreeBSD

pwd(1): De-obfuscate, style(9)
Needs ReviewPublic

Authored by olce on Tue, Sep 15, 4:07 PM.

Details

Reviewers
des
emaste
Summary

In getcwd_logical(), test for a '.' or '..' component in the most
straightforward and intelligible way possible. This removes
a superfluous retest of the the first character being '.' when the first
one did not pass and, more importantly, prevents the second test from
relying on a side-effect in the first.

While here, for better clarity, remove another side-effect in the
initialization statement of the inner loop, by incrementing 'p' before
the loop and leaving a small comment explaining why.

While here, test explicitly that pointed 'char' values are not 0 ('\0')
(style(9)).

No functional change (intended).

Fixes: 2df923c5d2d0 ("pwd: Clean up and adopt POSIX semantics")
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 76937
Build 73820: arc lint + arc unit