Skip to content

Commit bdd5b58

Browse files
runeksvendsenlaanwj
authored andcommitted
Add option to disable 077 umask (create new files with system default umask)
The option is only effective for either wallet-less builds or if -disablewallet is specified as well. Rebased-By: Wladimir J. van der Laan <[email protected]> Rebased-From: 34d5fc0 4e1a196 bd4307b d53a33b 7e09b36 Github-Pull: #4286
1 parent d5a6b78 commit bdd5b58

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/init.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,12 @@ std::string HelpMessage(HelpMessageMode mode)
224224
strUsage += " -par=<n> " + strprintf(_("Set the number of script verification threads (%u to %d, 0 = auto, <0 = leave that many cores free, default: %d)"), -(int)boost::thread::hardware_concurrency(), MAX_SCRIPTCHECK_THREADS, DEFAULT_SCRIPTCHECK_THREADS) + "\n";
225225
strUsage += " -pid=<file> " + _("Specify pid file (default: bitcoind.pid)") + "\n";
226226
strUsage += " -reindex " + _("Rebuild block chain index from current blk000??.dat files") + " " + _("on startup") + "\n";
227+
#if !defined(WIN32)
228+
strUsage += " -sysperms " + _("Create new files with system default permissions, instead of umask 077 (only effective with disabled wallet functionality)") + "\n";
229+
#endif
227230
strUsage += " -txindex " + _("Maintain a full transaction index (default: 0)") + "\n";
228231

232+
229233
strUsage += "\n" + _("Connection options:") + "\n";
230234
strUsage += " -addnode=<ip> " + _("Add a node to connect to and attempt to keep the connection open") + "\n";
231235
strUsage += " -banscore=<n> " + _("Threshold for disconnecting misbehaving peers (default: 100)") + "\n";
@@ -484,7 +488,15 @@ bool AppInit2(boost::thread_group& threadGroup)
484488
}
485489
#endif
486490
#ifndef WIN32
487-
umask(077);
491+
492+
if (GetBoolArg("-sysperms", false)) {
493+
#ifdef ENABLE_WALLET
494+
if (!GetBoolArg("-disablewallet", false))
495+
return InitError("Error: -sysperms is not allowed in combination with enabled wallet functionality");
496+
#endif
497+
} else {
498+
umask(077);
499+
}
488500

489501
// Clean shutdown on SIGTERM
490502
struct sigaction sa;

0 commit comments

Comments
 (0)