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