aboutsummaryrefslogtreecommitdiffstats
path: root/src/Daemon.cxx (unfollow)
Commit message (Collapse)AuthorFilesLines
2013-12-29daemon: no initgroups() when already running as the configured userMax Kellermann1-1/+5
We can assume that initgroups() would be a no-op in that case, however initgroups() is not allowed for unprivileged users anyway.
2013-12-29Daemon: fix typo in commentMax Kellermann1-1/+1
2013-12-29Daemon: simplify nested "if"Max Kellermann1-5/+4
2013-12-29Daemon: fix typo in castMax Kellermann1-1/+1
2013-12-15Daemon: use strdup() instead of g_strdup()Max Kellermann1-5/+3
2013-11-28include cleanup using iwyuMax Kellermann1-3/+0
2013-10-17fs/Path: rename to AllocatedPathMax Kellermann1-4/+4
The new class Path only holds a string pointer without being responsible for allocation/deallocation. The FileSystem.hxx library accepts Path arguments instead of AllocatedPath, to avoid forcing callers to allocate another string object.
2013-10-02Log: new logging library APIMax Kellermann1-5/+6
Prepare to migrate away from GLib. Currently, we're still using GLib as a backend.
2013-10-01Daemon, Mapper: move-assign the Path objectsMax Kellermann1-1/+1
2013-08-07ConfigPath: return a Path objectMax Kellermann1-15/+22
Migrate all callers to use Path directly, instead of doing the conversion in each caller.
2013-08-07Makefile.am: move sources to libsystem.aMax Kellermann1-1/+1
2013-08-07FatalError: new library to replace mpd_error.hMax Kellermann1-23/+23
2013-08-07daemon: convert to C++Max Kellermann1-13/+13
2011-03-31fix common misspellingsJonathan Neuschäfer1-1/+1
These fixes were mostly generated with `codespell' [0] and manually reviewed. [0] http://git.profusion.mobi/cgit.cgi/lucas/codespell/
2011-01-29copyright year 2011Max Kellermann1-1/+1
2010-09-25eliminate g_error() usageThomas Jansen1-19/+19
Replaced all occurrences of g_error() with MPD_ERROR() located in a new header file 'mpd_error.h'. This macro uses g_critical() to print the error message and then exits gracefully in contrast to g_error() which would internally call abort() to produce a core dump. The macro name is distinctive and allows to find all places with dubious error handling. The long-term goal is to get rid of MPD_ERROR() altogether. To facilitate the eventual removal of this macro it was added in a new header file rather than to an existing header file. This fixes #2995 and #3007.
2009-12-31Update copyright notices.Avuton Olrich1-1/+1
2009-08-13use daemon() when the C library provides itMike Frysinger1-6/+18
For systems that cannot support fork() (like no-mmu Linux), use daemon() if it is available for the daemonizing code. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-07-22daemon: daemonize_close_stdin() optimised.Michal Nazarewicz1-12/+2
Changed function to first close standard input (this may fail but we don't care) and then try to open /dev/null (this may fail but it shouldn't on Unix platforms plus we don't know what to do in such case anyways). Since standard input has the "zeroth" descriptor number next "open" will use it. Since there is no "/dev/null" on Windows (It's not even a valid path!) the second step is skipped if WIN32 is defined. As a final touch, since the function consists of merely two function calls it has been moved to header file and declared static inline. [mk: un-inline daemonize_close_stdin()]
2009-07-19daemon: Moved empty Windows version functions to header fileMichal Nazarewicz1-21/+6
On Windows only daemonize_close_stdin() function does something. Other functions are either empty or generate an error. Those have been moved to header file and declared static inline so compiler can remove the call all together.
2009-07-19daemon: added "group" configuration optionMichal Nazarewicz1-17/+31
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-03-13all: Update copyright header.Avuton Olrich1-4/+5
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-01daemon: disable daemonize_detach() on WIN32Max Kellermann1-1/+3
2009-02-19added G_LOG_DOMAIN macros to several librariesMax Kellermann1-0/+3
Define the GLib logging domain in the following libraries: conf, daemon, event_pipe, log.
2009-02-15daemon: return early from daemonize_set_user()Max Kellermann1-19/+20
If no "user" is configured, return from daemonize_set_user(). Save one level of indent.
2009-02-15daemon: ignore "user" setting if already running as that userMax Kellermann1-3/+6
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-15daemon: added comments to daemonize_detach()Max Kellermann1-0/+9
2009-02-15daemon: print fork error messageMax Kellermann1-2/+3
Print details on why the fork() fails.
2009-02-15daemon: moved code to daemonize_detach()Max Kellermann1-19/+23
Moved the code which detaches from the parent process/session to a separate function.
2009-01-18daemon: removed unused variable "userpwd"Max Kellermann1-8/+4
This causes a segmentation fault...
2009-01-18daemon: pass "detach" flag to daemonize()Max Kellermann1-3/+4
This way, we don't have to pass the full "Options" object to daemonize().
2009-01-18daemon: added daemonize_init(), daemonize_finish()Max Kellermann1-38/+62
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-18main: moved code to daemon.cMax Kellermann1-0/+97
Moved changeToUser(), cleanUpPidFile(), killFromPidFile() to daemon.c. These are daemonization functions.
2009-01-17conf: no CamelCase, part IMax Kellermann1-1/+2
Renamed functions, types, variables.
2009-01-13daemon: don't check the setsid() return valueMax Kellermann1-3/+1
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-13daemon: don't fork twice to daemonizeMax Kellermann1-8/+0
To detach from the parent process, fork once and make the old process exit. No need to do that twice.
2008-12-30daemon: simplified daemonize_close_stdin()Max Kellermann1-16/+6
Don't bother to call fstat() or isatty() on STDIN_FILENO.
2008-12-30listen: moved redirect_stdin() to daemon.cMax Kellermann1-0/+26
redirect_stdin() is a daemonization function, and disconnecting from the standard input is always a good idea for MPD.
2008-12-30main: moved daemonize() to daemon.cMax Kellermann1-0/+86