Added performance tests and creation permission flags
This commit is contained in:
35
src/main.c
35
src/main.c
@@ -10,6 +10,7 @@
|
||||
See the file LICENSE.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#define FUSE_USE_VERSION 31
|
||||
|
||||
#define _GNU_SOURCE
|
||||
@@ -29,7 +30,26 @@ const char *mountpoint = NULL;
|
||||
int main(int argc, char *argv[]) {
|
||||
if (argc < 3) {
|
||||
fprintf(stderr, "Usage: icfs <FUSE arguments> [target directory] [path to "
|
||||
"the permanent permissions database\n");
|
||||
"the permanent permissions database] <ICFS "
|
||||
"arguments>\n\t--no-perm-on-create - do not give permanent "
|
||||
"permissions to files a process creates automatically "
|
||||
"(incompatible with --temp-on-create)\n\t--temp-on-create "
|
||||
"- give temporary permissions to files a process creates "
|
||||
"automatically (incompatible with --no-perm-on-create)\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if ((0 == strcmp(argv[argc - 1], "--no-perm-on-create") &&
|
||||
0 == strcmp(argv[argc - 2], "--temp-on-create")) ||
|
||||
(0 == strcmp(argv[argc - 2], "--no-perm-on-create") &&
|
||||
0 == strcmp(argv[argc - 1], "--temp-on-create"))) {
|
||||
fprintf(stderr, "Usage: icfs <FUSE arguments> [target directory] [path to "
|
||||
"the permanent permissions database] <ICFS "
|
||||
"arguments>\n\t--no-perm-on-create - do not give permanent "
|
||||
"permissions to files a process creates automatically "
|
||||
"(incompatible with --temp-on-create)\n\t--temp-on-create "
|
||||
"- give temporary permissions to files a process creates "
|
||||
"automatically (incompatible with --no-perm-on-create)\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -37,11 +57,20 @@ int main(int argc, char *argv[]) {
|
||||
// permissions than it's caller reqested
|
||||
umask(0);
|
||||
|
||||
if (0 == strcmp(argv[argc - 1], "--no-perm-on-create")) {
|
||||
set_auto_create_perm(0);
|
||||
argc--;
|
||||
}
|
||||
if (0 == strcmp(argv[argc - 1], "--temp-on-create")) {
|
||||
set_auto_create_perm(GRANT_TEMP);
|
||||
argc--;
|
||||
}
|
||||
|
||||
// ui socket should always be initialized before anything else, since it
|
||||
// handles the setuid bits!
|
||||
int ret = init_ui_socket(argv[argc - 1]);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "Could not initalize ui-socket.\n");
|
||||
fprintf(stderr, "[ICFS] Could not initalize ui-socket.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -49,7 +78,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
ret = source_init(mountpoint);
|
||||
if (ret != 0) {
|
||||
perror("source_init");
|
||||
perror("[ICFS] source_init");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user