diff --git a/trac/util/daemon.py b/trac/util/daemon.py
|
a
|
b
|
|
| 17 | 17 | import sys |
| 18 | 18 | |
| 19 | 19 | def daemonize(pidfile=None, progname=None, stdin='/dev/null', |
| 20 | | stdout='/dev/null', stderr='/dev/null'): |
| | 20 | stdout='/dev/null', stderr='/dev/null', umask=022): |
| 21 | 21 | """Fork a daemon process.""" |
| 22 | 22 | |
| 23 | 23 | if pidfile: |
| … |
… |
|
| 50 | 50 | |
| 51 | 51 | # Decouple from parent environment |
| 52 | 52 | os.chdir('/') |
| 53 | | os.umask(0) |
| | 53 | os.umask(umask) |
| 54 | 54 | os.setsid() |
| 55 | 55 | |
| 56 | 56 | # Perform second fork |
diff --git a/trac/web/standalone.py b/trac/web/standalone.py
|
a
|
b
|
|
| 169 | 169 | parser.add_option('--pidfile', action='store', |
| 170 | 170 | dest='pidfile', |
| 171 | 171 | help='When daemonizing, file to which to write pid') |
| | 172 | parser.add_option('--umask', action='store', type='int', dest='umask', |
| | 173 | metavar='MASK', |
| | 174 | help='When daemonizing, file mode creation mask ' |
| | 175 | 'to use (default 022)') |
| 172 | 176 | |
| 173 | 177 | parser.set_defaults(port=None, hostname='', base_path='', daemonize=False, |
| 174 | | protocol='http') |
| | 178 | protocol='http', umask=022) |
| 175 | 179 | options, args = parser.parse_args() |
| 176 | 180 | |
| 177 | 181 | if not args and not options.env_parent_dir: |
| … |
… |
|
| 243 | 247 | |
| 244 | 248 | try: |
| 245 | 249 | if options.daemonize: |
| 246 | | daemon.daemonize(pidfile=options.pidfile, progname='tracd') |
| | 250 | daemon.daemonize(pidfile=options.pidfile, progname='tracd', |
| | 251 | umask=options.umask) |
| 247 | 252 | |
| 248 | 253 | if options.autoreload: |
| 249 | 254 | def modification_callback(file): |