Package: mini-dinstall
Version: 0.6.31
Severity: normal
Tags: patch

mini-dinstall should not crash if its lock file is empty. I use
mini-dinstall in daemon mode.
>From 0348ac6092f1356eafe625ed2432e9d64ad7b013 Mon Sep 17 00:00:00 2001
From: Tzafrir Cohen <tzafrir.co...@xorcom.com>
Date: Thu, 26 May 2016 13:40:09 +0300
Subject: [PATCH] Ignore an empty lock file

Signed-off-by: Tzafrir Cohen <tzafrir.co...@xorcom.com>
---
 mini-dinstall | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/mini-dinstall b/mini-dinstall
index 77d1c34..6655c37 100755
--- a/mini-dinstall
+++ b/mini-dinstall
@@ -260,7 +260,10 @@ def process_exists(pid):
     return 1
 
 if os.access(lockfilename, os.R_OK):
-    pid = int(open(lockfilename).read())
+    try:
+        pid = int(open(lockfilename).read())
+    except ValueError:
+        pid = 0 # likely an empty lock file
     if not process_exists(pid):
         if run_mode:
             logger.error("No process running at %d; use mini-dinstall -k to 
remove lockfile")
-- 
2.11.0

Reply via email to