Browse Source

option_parser: return 0 when requesting help or version

pull/825/head
Antonio SJ Musumeci 4 years ago
parent
commit
767039c492
  1. 16
      src/option_parser.cpp

16
src/option_parser.cpp

@ -129,7 +129,8 @@ namespace l
else else
{ {
l::read_config(data_,is); l::read_config(data_,is);
if(is.fail())
data_->errs->push_back("failure reading config file");
is.close(); is.close();
} }
} }
@ -426,17 +427,13 @@ option_processor(void *data_,
case MERGERFS_OPT_HELP: case MERGERFS_OPT_HELP:
usage(); usage();
close(2);
dup(1);
fuse_opt_add_arg(outargs_,"-ho");
break;
exit(0);
case MERGERFS_OPT_VERSION: case MERGERFS_OPT_VERSION:
std::cout << "mergerfs version: " std::cout << "mergerfs version: "
<< (MERGERFS_VERSION[0] ? MERGERFS_VERSION : "unknown") << (MERGERFS_VERSION[0] ? MERGERFS_VERSION : "unknown")
<< std::endl; << std::endl;
fuse_opt_add_arg(outargs_,"--version");
break;
exit(0);
default: default:
break; break;
@ -470,6 +467,11 @@ namespace options
opts, opts,
::option_processor); ::option_processor);
if(config_->branches.vec.empty())
errs_->push_back("branches not set");
if(config_->mount->empty())
errs_->push_back("mountpoint not set");
set_default_options(args_); set_default_options(args_);
set_fsname(args_,config_); set_fsname(args_,config_);
set_subtype(args_); set_subtype(args_);

Loading…
Cancel
Save