realpath: remove extraneous '/' for --relative-to edge cases
authorPádraig Brady <P@draigBrady.com>
Wed, 25 Jan 2012 16:42:42 +0000 (16:42 +0000)
committerPádraig Brady <P@draigBrady.com>
Wed, 25 Jan 2012 18:01:52 +0000 (18:01 +0000)
commit11af4b31b61302188a65e521921c42ddb45c4fb9
tree8cab26a184bf4f9776b25b61f7bdd6292645cac1
parente9a2555826767baae96a3eabca1f9d91bddca619
realpath: remove extraneous '/' for --relative-to edge cases

* src/realpath.c (path_common_prefix): Be consistent and
always include a leading '/' in the count returned.
(relpath): Account for the change in path_common_prefix()
and avoid outputting extra '/' chars in relative paths that
span the root dir.
* tests/misc/realpath: Add the two reported cases.
Reported by Mike Frysinger
src/realpath.c
tests/misc/realpath