Skip to content

Commit

Permalink
Add option to disable 077 umask (create new files with system default…
Browse files Browse the repository at this point in the history
… 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 <laanwj@gmail.com>
Rebased-From: 34d5fc0 4e1a196 bd4307b d53a33b 7e09b36
Github-Pull: bitcoin#4286
(cherry picked from commit bdd5b58)

# Conflicts:
#	src/init.cpp
  • Loading branch information
runeksvendsen authored and reddink committed May 26, 2020
1 parent 34b5ecf commit 1a093ba
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ std::string HelpMessage(HelpMessageMode mode)
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";
strUsage += " -pid=<file> " + _("Specify pid file (default: reddcoind.pid)") + "\n";
strUsage += " -reindex " + _("Rebuild block chain index from current blk000??.dat files") + " " + _("on startup") + "\n";
#if !defined(WIN32)
strUsage += " -sysperms " + _("Create new files with system default permissions, instead of umask 077 (only effective with disabled wallet functionality)") + "\n";
#endif
strUsage += " -txindex " + _("Maintain a full transaction index (default: 1)") + "\n";

strUsage += "\n" + _("Connection options:") + "\n";
Expand Down Expand Up @@ -492,7 +495,15 @@ bool AppInit2(boost::thread_group& threadGroup)
}
#endif
#ifndef WIN32
umask(077);

if (GetBoolArg("-sysperms", false)) {
#ifdef ENABLE_WALLET
if (!GetBoolArg("-disablewallet", false))
return InitError("Error: -sysperms is not allowed in combination with enabled wallet functionality");
#endif
} else {
umask(077);
}

// Clean shutdown on SIGTERM
struct sigaction sa;
Expand Down

0 comments on commit 1a093ba

Please sign in to comment.