canonicalize: add support for not resolving symlinks
authorPádraig Brady <P@draigBrady.com>
Thu, 29 Dec 2011 23:49:53 +0000 (23:49 +0000)
committerPádraig Brady <P@draigBrady.com>
Fri, 30 Dec 2011 12:43:43 +0000 (12:43 +0000)
commit8bcd0399386f6c3298ee63da74c58f80053d5a42
tree4129f0562bb854b9135b71b02c0972bcc1ee1a10
parent771de9614b52042c1870625d412263a22708152e
canonicalize: add support for not resolving symlinks

This will initially be used by a new coreutils realpath command.

* lib/canonicalize.h: Add the CAN_NOLINKS flag to
indicate we don't want to follow symlinks.  Also
provide CAN_MODE_MASK to aid setting these existing
mutually exclusive values.
* lib/canonicalize.c (canonicalize_filename_mode):
Extract the flags from can_mode parameter, which
are currently just used to select between stat()
and lstat().  Also ensure that mutually exclusive
values are flagged immediately as invalid.
* tests/test-canonicalize.c: Verify symlinks are
not followed, and that invalid flag combinations
are diagnosed.
ChangeLog
lib/canonicalize.c
lib/canonicalize.h
tests/test-canonicalize.c