now files and directories have the correct owner

This commit is contained in:
Fufu Fang 2018-07-24 23:26:13 +01:00
parent 3c27529f48
commit ff8a08a3f1
1 changed files with 10 additions and 0 deletions

10
main.c
View File

@ -8,8 +8,13 @@
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
static char *BASE_URL;
static uid_t uid;
static gid_t gid;
static void fs_usage();
static void *fs_init(struct fuse_conn_info *conn);
@ -37,7 +42,10 @@ int main(int argc, char **argv) {
fs_usage();
}
uid = getuid();
gid = getgid();
BASE_URL = argv[argc-2];
argv[argc-2] = argv[argc-1];
argv[argc-1] = NULL;
argc--;
@ -89,6 +97,8 @@ static int fs_getattr(const char *path, struct stat *stbuf)
return -ENOENT;
}
}
stbuf->st_uid = uid;
stbuf->st_gid = gid;
return res;
}