Skip to content

Commit

Permalink
Correcting to account for jgarzik's feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
runeksvendsen committed Jun 5, 2014
1 parent 34d5fc0 commit 4e1a196
Showing 1 changed file with 10 additions and 27 deletions.
37 changes: 10 additions & 27 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,7 @@ std::string HelpMessage(HelpMessageMode hmm)
strUsage += " -reindex " + _("Rebuild block chain index from current blk000??.dat files") + " " + _("on startup") + "\n";
strUsage += " -txindex " + _("Maintain a full transaction index (default: 0)") + "\n";
#if !defined(WIN32)
#ifdef ENABLE_WALLET
strUsage += " -laxperms " + _("Create new files with system default permissions, instead of umask 077 (only effective with -disablewallet)") + "\n";
#else
strUsage += " -laxperms " + _("Create new files with system default permissions, instead of umask 077") + "\n";
#endif
strUsage += " -sysperms " + _("Create new files with system default permissions, instead of umask 077 (only effective with disabled wallet functionality)") + "\n";
#endif

strUsage += "\n" + _("Connection options:") + "\n";
Expand Down Expand Up @@ -429,6 +425,15 @@ bool AppInit2(boost::thread_group& threadGroup)
}
#endif
#ifndef WIN32

#ifdef ENABLE_WALLET
if (!GetBoolArg("-sysperms", false) || !GetBoolArg("-disablewallet", false))
umask(077);
#else
if (!GetBoolArg("-sysperms", false))
umask(077);
#endif

// Clean shutdown on SIGTERM
struct sigaction sa;
sa.sa_handler = HandleSIGTERM;
Expand Down Expand Up @@ -592,28 +597,6 @@ bool AppInit2(boost::thread_group& threadGroup)
#endif
// ********************************************************* Step 4: application initialization: dir lock, daemonize, pidfile, debug log

#ifndef WIN32
bool fCanUseLaxPerms = false;

#ifdef ENABLE_WALLET
if (fDisableWallet)
fCanUseLaxPerms = true;
#else
fCanUseLaxPerms = true;
#endif //ENABLE_WALLET

if (!GetBoolArg("-laxperms", false)) {
umask(077);
} else {
if (fCanUseLaxPerms) {
LogPrintf("Using non-restrictive permissions (not setting umask to 077)\n");
} else {
umask(077);
InitWarning("Using non-restrictive permissions is not allowed without -disablewallet\n");
}
}
#endif //WIN32

std::string strDataDir = GetDataDir().string();
#ifdef ENABLE_WALLET
// Wallet file must be a plain filename without a directory
Expand Down

0 comments on commit 4e1a196

Please sign in to comment.