@@ -399,6 +399,7 @@ struct Operations : fuse_operations {
399399 cfg->use_ino = true ;
400400 cfg->nullpath_ok = true ;
401401 cfg->direct_io = g_direct_io;
402+ LOG (DEBUG ) << " Initialized FUSE server" ;
402403 return nullptr ;
403404 }
404405#endif
@@ -554,17 +555,16 @@ static int ProcessArg(void* data,
554555
555556 case KEY_DEFAULT_PERMISSIONS :
556557 DataNode::original_permissions = true ;
557- return KEEP ;
558+ return DISCARD ;
558559
559560#if FUSE_USE_VERSION >= 30
560561 case KEY_DIRECT_IO :
561562 g_direct_io = true ;
562563 return DISCARD ;
563564#endif
564-
565- default :
566- return KEEP ;
567565 }
566+
567+ return KEEP ;
568568}
569569
570570// Removes directory |dir| in destructor.
@@ -662,6 +662,23 @@ int main(int argc, char* argv[]) try {
662662 return EXIT_FAILURE ;
663663 }
664664
665+ // Single-threaded operation.
666+ fuse_opt_add_arg (&args, " -s" );
667+
668+ // Mount read-only.
669+ fuse_opt_add_arg (&args, " -r" );
670+
671+ #if FUSE_USE_VERSION < 30
672+ // Respect inode numbers.
673+ fuse_opt_add_arg (&args, " -o" );
674+ fuse_opt_add_arg (&args, " use_ino" );
675+ #endif
676+
677+ if (DataNode::original_permissions) {
678+ fuse_opt_add_arg (&args, " -o" );
679+ fuse_opt_add_arg (&args, " default_permissions" );
680+ }
681+
665682 std::string mount_point;
666683 if (param.paths .size () > 1 ) {
667684 mount_point = std::move (param.paths .back ());
@@ -731,18 +748,13 @@ int main(int argc, char* argv[]) try {
731748 }
732749 }
733750
734- fuse_opt_add_arg (&args, mount_point.c_str ());
735-
736- #if FUSE_USE_VERSION < 30
737- // Respect inode numbers.
738- fuse_opt_add_arg (&args, " -ouse_ino" );
739- #endif
740-
741- // Read-only mounting.
742- fuse_opt_add_arg (&args, " -r" );
743-
744- // Single-threaded operation.
745- fuse_opt_add_arg (&args, " -s" );
751+ // The mount point is in place.
752+ if (mount_point.starts_with (' -' )) {
753+ // To prevent the mount point from being mistaken as a command line option.
754+ fuse_opt_add_arg (&args, StrCat (" ./" , mount_point).c_str ());
755+ } else {
756+ fuse_opt_add_arg (&args, mount_point.c_str ());
757+ }
746758
747759 return fuse_main (args.argc , args.argv , &operations, nullptr );
748760} catch (const ZipError& e) {
0 commit comments