Browse Source

Merge pull request #1271 from trapexit/warn-root

Warn if not running as root
pull/1275/head
trapexit 1 year ago
committed by GitHub
parent
commit
7d6c8e9333
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      src/mergerfs.cpp

17
src/mergerfs.cpp

@ -230,6 +230,21 @@ namespace l
std::signal(SIGUSR2,l::usr2_signal_handler); std::signal(SIGUSR2,l::usr2_signal_handler);
} }
static
void
warn_if_not_root()
{
uid_t uid;
uid = geteuid();
if(uid == 0)
return;
char const *s = "mergerfs is not running as root and may not work correctly\n";
fprintf(stderr,"warning: %s",s);
syslog_warning(s);
}
int int
main(const int argc_, main(const int argc_,
char **argv_) char **argv_)
@ -241,6 +256,8 @@ namespace l
syslog_open(); syslog_open();
l::warn_if_not_root();
memset(&ops,0,sizeof(fuse_operations)); memset(&ops,0,sizeof(fuse_operations));
args.argc = argc_; args.argc = argc_;

Loading…
Cancel
Save