From 24ba1bb35663cbbf6b7b4228044d5e7deef4e983 Mon Sep 17 00:00:00 2001 From: rrizun Date: Mon, 18 Feb 2008 18:53:24 +0000 Subject: [PATCH] root_mode git-svn-id: http://s3fs.googlecode.com/svn/trunk@64 df820570-a93a-0410-bd06-b72b767a4274 --- s3fs/s3fs.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/s3fs/s3fs.cpp b/s3fs/s3fs.cpp index 8b003ae..623c216 100644 --- a/s3fs/s3fs.cpp +++ b/s3fs/s3fs.cpp @@ -198,6 +198,7 @@ static string bucket; static string AWSAccessKeyId; static string AWSSecretAccessKey; static const string host = "http://s3.amazonaws.com"; +static mode_t root_mode = 0; // key=path typedef map stat_cache_t; @@ -508,7 +509,7 @@ s3fs_getattr(const char *path, struct stat *stbuf) { memset(stbuf, 0, sizeof(struct stat)); if (strcmp(path, "/") == 0) { stbuf->st_nlink = 1; // see fuse faq - stbuf->st_mode = S_IFDIR | 0755; + stbuf->st_mode = root_mode | S_IFDIR; return 0; } @@ -984,6 +985,12 @@ my_fuse_opt_proc(void *data, const char *arg, int key, struct fuse_args *outargs if (bucket.size() == 0) { bucket = arg; return 0; + } else { + struct stat buf; + // its the mountpoint... what is its mode? + if (stat(arg, &buf) != -1) { + root_mode = buf.st_mode; + } } } if (key == FUSE_OPT_KEY_OPT) {