2009
12.01

A friend of mine pointed me to some Daemon initialization code which looked like

...
return pid if pid = fork
File.umask 0000
...

Setting the umask to 0 is quite common when writing daemons to avoid making any assumption with respect to the current umask set for the shell/parent running the daemon (the primary goal of a umask is to restrict permissions).

If the child doesn’t leverage this freedom though and doesn’t specify the permission masks when calling open(), files created will likely have -rw-rw-rw- and directories drwxrwxrwx. This can be bad as the umask will be also inherited to all child processes spawned…

Share and Enjoy:
  • Twitter
  • Facebook
  • StumbleUpon
  • Google Bookmarks
  • LinkedIn
  • email
  • Slashdot
  • Digg
  • Netvibes
  • del.icio.us
  • HackerNews

No Comment.

Add Your Comment