Michal Nazarewicz
d718a8b59d
daemon: added "group" configuration option
...
The "group" configuration option is similar to "user" as it
sets user set what group MPD shall run as. With "user"
option, MPD changed GID to the GID of the user, however,
more control could be desired.
Moreover, the patch changes the way of checking whether no
setuid(2)/setgid(2) is required -- previously user names
were compered, now UID and GIDs are compered (ie. the one we
already have (getuid(2)/getgid(2)) with the one we want to
change to).
2009-07-19 08:17:55 +02:00
Avuton Olrich
0aee49bdf8
all: Update copyright header.
...
This updates the copyright header to all be the same, which is
pretty much an update of where to mail request for a copy of the GPL
and the years of the MPD project. This also puts all committers under
'The Music Player Project' umbrella. These entries should go
individually in the AUTHORS file, for consistancy.
2009-03-13 11:51:55 -07:00
Max Kellermann
eb64f6542f
daemon: disable daemonize_detach() on WIN32
2009-03-01 01:35:53 +01:00
Max Kellermann
eac2da635d
added G_LOG_DOMAIN macros to several libraries
...
Define the GLib logging domain in the following libraries: conf,
daemon, event_pipe, log.
2009-02-19 09:24:59 +01:00
Max Kellermann
92c203d705
daemon: return early from daemonize_set_user()
...
If no "user" is configured, return from daemonize_set_user(). Save
one level of indent.
2009-02-15 16:58:52 +01:00
Max Kellermann
98994c5939
daemon: ignore "user" setting if already running as that user
...
If mpd.conf specifies a user, and MPD is invoked by exactly this user,
ignore the "user" setting. Don't bother to look up its groups and
don't attempt to change uid, it won't work anyway.
2009-02-15 16:47:21 +01:00
Max Kellermann
59e62d95bd
daemon: added comments to daemonize_detach()
2009-02-15 16:28:39 +01:00
Max Kellermann
42415592b4
daemon: print fork error message
...
Print details on why the fork() fails.
2009-02-15 16:27:50 +01:00
Max Kellermann
fd8c63b619
daemon: moved code to daemonize_detach()
...
Moved the code which detaches from the parent process/session to a
separate function.
2009-02-15 16:27:09 +01:00
Max Kellermann
5ba43e4ac2
daemon: removed unused variable "userpwd"
...
This causes a segmentation fault...
2009-01-18 18:42:44 +01:00
Max Kellermann
9c93249412
daemon: pass "detach" flag to daemonize()
...
This way, we don't have to pass the full "Options" object to
daemonize().
2009-01-18 18:29:30 +01:00
Max Kellermann
bfcaecabbd
daemon: added daemonize_init(), daemonize_finish()
...
The constructor/destructor functions parse and free the configuration
properly. This way, we don't have to load the pid file path more than
once.
2009-01-18 18:29:27 +01:00
Max Kellermann
90b34f8e6f
main: moved code to daemon.c
...
Moved changeToUser(), cleanUpPidFile(), killFromPidFile() to
daemon.c. These are daemonization functions.
2009-01-18 17:15:34 +01:00
Max Kellermann
4d472c265e
conf: no CamelCase, part I
...
Renamed functions, types, variables.
2009-01-17 20:23:27 +01:00
Max Kellermann
18cb34700e
daemon: don't check the setsid() return value
...
There is only one valid error condition for setsid(): when the current
process is already the process group leader. This is non-critical.
2009-01-13 21:45:44 +01:00
Max Kellermann
2532129755
daemon: don't fork twice to daemonize
...
To detach from the parent process, fork once and make the old process
exit. No need to do that twice.
2009-01-13 21:44:42 +01:00
Max Kellermann
cdf1eaeb2c
daemon: simplified daemonize_close_stdin()
...
Don't bother to call fstat() or isatty() on STDIN_FILENO.
2008-12-30 16:28:18 +01:00
Max Kellermann
6c0f5fc612
listen: moved redirect_stdin() to daemon.c
...
redirect_stdin() is a daemonization function, and disconnecting from
the standard input is always a good idea for MPD.
2008-12-30 16:28:13 +01:00
Max Kellermann
671480814c
main: moved daemonize() to daemon.c
2008-12-30 16:28:07 +01:00