Warn if not running as root

This commit is contained in:
Antonio SJ Musumeci 2023-10-22 00:43:19 -05:00
parent 5c71a75fdd
commit a7069153bd

View File

@ -230,6 +230,21 @@ namespace l
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
main(const int argc_,
char **argv_)
@ -241,6 +256,8 @@ namespace l
syslog_open();
l::warn_if_not_root();
memset(&ops,0,sizeof(fuse_operations));
args.argc = argc_;