From 6ade44c773c6c8955f96ce15755db6f6f8e39c3b Mon Sep 17 00:00:00 2001 From: Unrud Date: Sun, 7 May 2017 21:56:02 +0200 Subject: [PATCH] Make relative PID path absolute The daemon changes the current directory to root. --- radicale/__main__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/radicale/__main__.py b/radicale/__main__.py index 70bf762..35c2361 100644 --- a/radicale/__main__.py +++ b/radicale/__main__.py @@ -120,9 +120,9 @@ def daemonize(configuration, logger): # Check and create PID file in a race-free manner if configuration.get("server", "pid"): try: + pid_path = os.path.abspath(configuration.get("server", "pid")) pid_fd = os.open( - configuration.get("server", "pid"), - os.O_CREAT | os.O_EXCL | os.O_WRONLY) + pid_path, os.O_CREAT | os.O_EXCL | os.O_WRONLY) except OSError as e: raise OSError("PID file exists: %s" % configuration.get("server", "pid")) from e @@ -149,7 +149,7 @@ def daemonize(configuration, logger): # Remove PID file if (configuration.get("server", "pid") and configuration.getboolean("server", "daemon")): - os.unlink(configuration.get("server", "pid")) + os.unlink(pid_path) atexit.register(cleanup)