summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2015-02-12 01:01:58 +0100
committerJavier <dev.git@javispedro.com>2015-02-12 01:01:58 +0100
commit3cdfaa1b7a5cb91ff64b61fb85820198a6e8669e (patch)
tree03b3a7dc49fab097bd2ac4fb13c3d6f83b7ec029
parent91d30f08c972bf9e9c9a4d39574b25a5e3a94c78 (diff)
downloadvolumefs-3cdfaa1b7a5cb91ff64b61fb85820198a6e8669e.tar.gz
volumefs-3cdfaa1b7a5cb91ff64b61fb85820198a6e8669e.zip
properly return enoent for nonexisting files
-rw-r--r--src/volumesfs.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/volumesfs.c b/src/volumesfs.c
index dc67f77..4226b94 100644
--- a/src/volumesfs.c
+++ b/src/volumesfs.c
@@ -98,8 +98,15 @@ static int volumesfs_getattr(const char *path, struct stat *stbuf)
stbuf->st_mode = S_IFDIR | 0755;
stbuf->st_nlink = 2;
} else {
- stbuf->st_mode = S_IFLNK | 0444;
- stbuf->st_nlink = 1;
+ G_LOCK(mounts);
+ const gchar *mountpoint = g_hash_table_lookup(mounts, path + 1);
+ G_UNLOCK(mounts);
+ if (mountpoint) {
+ stbuf->st_mode = S_IFLNK | 0444;
+ stbuf->st_nlink = 1;
+ } else {
+ return -ENOENT;
+ }
}
return 0;
}