diff options
author | Henry Stern <stern@fsi.io> | 2015-09-11 08:06:24 -0300 |
---|---|---|
committer | Henry Stern <stern@fsi.io> | 2015-09-11 12:52:39 -0300 |
commit | 5922a236d0ce7fcf911fce6ff7a52b11ddcf2142 (patch) | |
tree | 4eddce160a123c0c9b908b85d21f3729b9fe1906 /src/bindfs.c | |
parent | f7b7a42f8c9e148f53c09b4eabaa3797ecbb9915 (diff) | |
download | bindfs-5922a236d0ce7fcf911fce6ff7a52b11ddcf2142.tar.gz |
Don't resolve broken symbolic links.
This commit offers an alternative behaviour of not resolving broken
symbolic links in case returning ENOENT is undesirable behaviour.
Diffstat (limited to 'src/bindfs.c')
-rw-r--r-- | src/bindfs.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/bindfs.c b/src/bindfs.c index dcb7a6f..3ee8ac5 100644 --- a/src/bindfs.c +++ b/src/bindfs.c @@ -248,6 +248,8 @@ static int is_mirrored_user(uid_t uid) static char * process_path(const char *path) { + char * res; + if (path == NULL) { /* possible? */ errno = EINVAL; return NULL; @@ -259,10 +261,13 @@ static char * process_path(const char *path) if (*path == '\0') path = "."; - if (settings.resolve_symlinks) - return realpath(path, NULL); - else - return strdup(path); + if (settings.resolve_symlinks) { + res = realpath(path, NULL); + if (res) + return res; + } + + return strdup(path); } static int getattr_common(const char *procpath, struct stat *stbuf) |