`DAEMON_UMASK` used in `daemonize()` has a weird value
The daemonize()
function applies a new umask to the daemon process by calling umask(DAEMON_UMASK)
. The constant for this has a weird value, though:
/*
* Daemon umask value.
*/
#define DAEMON_UMASK 0x133 /* 0644 */
I don't know why an octal 0644
value isn't used in the first place, instead of writing this as a comment only. The constant 0x133 corresponds to an octal value of 0463
, though. It will mask out the owner-readable bit, read-write bits for the group and write-execute bits for world. This is likely not what was intended here.
Luckily no world-writable files will come into existence this way, but the misconfiguration could lead to strange effects in the future, e.g. because the owner of the file will not have read permissions for it.