aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Pärtel <martin.partel@gmail.com>2012-07-03 11:18:33 +0300
committerMartin Pärtel <martin.partel@gmail.com>2012-07-03 11:18:33 +0300
commit8a2f2d07702f83b4f170f7cb4789536921f22bf0 (patch)
tree07314d77a83bd0fbe2828199aa198a286223314f /src
parent99003bc33fa71dfd91bafdbcc8b563f396d1bb52 (diff)
downloadbindfs-8a2f2d07702f83b4f170f7cb4789536921f22bf0.tar.gz
Fail readdir() if pathconf fails.
Diffstat (limited to 'src')
-rw-r--r--src/bindfs.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/bindfs.c b/src/bindfs.c
index 48b732c..ce22825 100644
--- a/src/bindfs.c
+++ b/src/bindfs.c
@@ -401,10 +401,14 @@ static int bindfs_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
struct stat st;
int result = 0;
long pc_ret;
-
+
pc_ret = pathconf(path, _PC_NAME_MAX);
- if (pc_ret < 0)
- pc_ret = NAME_MAX; /* or scream and abort()? */
+ if (pc_ret < 0) {
+ DPRINTF("pathconf failed: %s (%d)", strerror(errno), errno);
+ /* Could use NAME_MAX but it may not be safe if the underlying
+ * FS is NFS or similar. */
+ return -errno;
+ }
de_buf = malloc(offsetof(struct dirent, d_name) + pc_ret + 1);
seekdir(dp, offset);