From 6e5c10d60ebb4ebaf38464b85f25a6597936dbb3 Mon Sep 17 00:00:00 2001 From: Les De Ridder Date: Sun, 16 Oct 2016 05:26:45 +0200 Subject: [PATCH] Set uid and gid --- source/filesystem.d | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/source/filesystem.d b/source/filesystem.d index b8c5a08..05df171 100644 --- a/source/filesystem.d +++ b/source/filesystem.d @@ -9,6 +9,8 @@ import std.array; import std.string; import std.stdio; +import core.sys.posix.unistd; + import dfuse.fuse; import dtagfs.tagprovider; @@ -18,6 +20,9 @@ class FileSystem : Operations private string _source; private TagProvider[] _tagProviders; + private uid_t _uid; + private gid_t _gid; + private string[][string] _tagCache; this(string source, TagProvider[] tagProviders) @@ -25,6 +30,9 @@ class FileSystem : Operations _source = source; _tagProviders = tagProviders; + _uid = getuid(); + _gid = getgid(); + cacheTags(); } @@ -47,9 +55,12 @@ class FileSystem : Operations override void getattr(const(char)[] path, ref stat_t stat) { + stat.st_uid = _uid; + stat.st_gid = _gid; + if(path == "/" || isTag(path.baseName)) { - stat.st_mode = S_IFDIR | octal!500; + stat.st_mode = S_IFDIR | octal!555; stat.st_size = 0; return; } @@ -58,7 +69,7 @@ class FileSystem : Operations auto file = findFile(path.baseName); lstat(toStringz(file), &stat); - stat.st_mode = S_IFREG | octal!400; + stat.st_mode = S_IFREG | octal!444; return; }