]> granicus.if.org Git - cronie/commitdiff
Avoid creating pid files when crond doesn't fork
authorKristýna Streitová <kstreitova@suse.com>
Wed, 29 Mar 2017 10:15:31 +0000 (12:15 +0200)
committerTomáš Mráz <t8m@users.noreply.github.com>
Wed, 29 Mar 2017 13:34:02 +0000 (15:34 +0200)
When the cron daemon does not fork, as it is the case when using
systemd, pid files are useless. Avoid creating them in the first
place.

This change originally comes from cronie-nofork-nopid.patch
added to openSUSE by Cristian Rodríguez (crrodriguez@opensuse.org).

src/misc.c

index 10b6fd641e8124d3e348e5ffc8379b6ef7633353..01df75a3c19a75fd1b3587bb32a69659b7a96668 100644 (file)
@@ -315,6 +315,8 @@ void acquire_daemonlock(int closeflag) {
                return;
        }
 
+       if(NoFork == 1) return; //move along, nothing to do here...
+
        if (fd == -1) {
                pidfile = _PATH_CRON_PID;
                /* Initial mode is 0600 to prevent flock() race/DoS. */