Drop the leading zero for permissions in the settings file. (#3248)

This change has been in the back of my head since I made pull request #2984.
Dropping the zero does not change any of the behaviour.
And this way the format is more familiar to users of the unixoid
octal permissions. Those permissions would not be specified with
a leading zero.
If they were specified with a leading zero, it would mean that some
special permission bits (setuid, setgid or sticky) should be cleared.
Thus removing the leading zero in our settings format removes two
cases of possible confusion.
Additionally the permissions are always padded to three digits to avoid
strangely looking permission strings.
This commit is contained in:
Max Zettlmeißl 2022-06-11 02:04:34 +02:00 committed by GitHub
parent 30f56f94e6
commit 7269db2d45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -370,7 +370,7 @@ void tr_sessionGetDefaultSettings(tr_variant* d)
tr_variantDictAddBool(d, TR_KEY_rpc_host_whitelist_enabled, true);
tr_variantDictAddInt(d, TR_KEY_rpc_port, TR_DEFAULT_RPC_PORT);
tr_variantDictAddStrView(d, TR_KEY_rpc_url, TR_DEFAULT_RPC_URL_STR);
tr_variantDictAddStr(d, TR_KEY_rpc_socket_mode, fmt::format("{:#o}", tr_rpc_server::DefaultRpcSocketMode));
tr_variantDictAddStr(d, TR_KEY_rpc_socket_mode, fmt::format("{:03o}", tr_rpc_server::DefaultRpcSocketMode));
tr_variantDictAddBool(d, TR_KEY_scrape_paused_torrents_enabled, true);
tr_variantDictAddStrView(d, TR_KEY_script_torrent_added_filename, "");
tr_variantDictAddBool(d, TR_KEY_script_torrent_added_enabled, false);
@ -389,7 +389,7 @@ void tr_sessionGetDefaultSettings(tr_variant* d)
tr_variantDictAddInt(d, TR_KEY_alt_speed_time_day, TR_SCHED_ALL);
tr_variantDictAddInt(d, TR_KEY_speed_limit_up, 100);
tr_variantDictAddBool(d, TR_KEY_speed_limit_up_enabled, false);
tr_variantDictAddStr(d, TR_KEY_umask, fmt::format("{:#o}", DefaultUmask));
tr_variantDictAddStr(d, TR_KEY_umask, fmt::format("{:03o}", DefaultUmask));
tr_variantDictAddInt(d, TR_KEY_upload_slots_per_torrent, 14);
tr_variantDictAddStrView(d, TR_KEY_bind_address_ipv4, TR_DEFAULT_BIND_ADDRESS_IPV4);
tr_variantDictAddStrView(d, TR_KEY_bind_address_ipv6, TR_DEFAULT_BIND_ADDRESS_IPV6);