pkcsslotd executable creates a pidfile as /var/lib/opencryptoki/.slotpid
(CONFIG_PATH + "/.slotpid"), but the corresponding initscipt expects the
pidfile at /var/run/pkcsslotd.pid and this one is used to check whether
the service is running etc. The attached patch switches pkcsslotd to using
the /var/run/pkcsslotd.pid one and also simplifies the logic in the initscript
because the daemon function takes care of the checked cases.

Signed-off-by: Dan Horák <[email protected]>
---
 misc/pkcsslotd.in            |   14 +-------------
 usr/include/pkcs11/slotmgr.h |    2 +-
 2 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/misc/pkcsslotd.in b/misc/pkcsslotd.in
index 99c0a5e..2c5cd34 100644
--- a/misc/pkcsslotd.in
+++ b/misc/pkcsslotd.in
@@ -27,19 +27,7 @@ start() {
         # Generate the configuration information
         $CONFSTART
 
-       ## Start daemon with startproc(8). If this fails
-       ## the echo return value is set appropriate.
-        if [ ! -f $PIDFILE ]; then
-           # pid file does not exist
-           daemon --force $SLOTDBIN
-        elif ! ps -h --pid `cat $PIDFILE` | grep "$SLOTDBIN" 2>&1 >/dev/null; 
then
-           # pid file exists but named pid not
-           rm -f $PIDFILE
-           daemon --force $SLOTDBIN
-        else
-           # just to have "failed" message
-           daemon $SLOTDBIN
-        fi
+        daemon $SLOTDBIN
 
        RETVAL=$?
        echo
diff --git a/usr/include/pkcs11/slotmgr.h b/usr/include/pkcs11/slotmgr.h
index 237cfae..36065b8 100755
--- a/usr/include/pkcs11/slotmgr.h
+++ b/usr/include/pkcs11/slotmgr.h
@@ -325,7 +325,7 @@
 #endif
 
 
-#define PID_FILE_PATH CONFIG_PATH "/.slotpid"
+#define PID_FILE_PATH "/var/run/pkcsslotd.pid"
 
 #ifndef CK_BOOL
     #define CK_BOOL  CK_BBOOL
-- 
1.6.6.1


------------------------------------------------------------------------------
_______________________________________________
Opencryptoki-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opencryptoki-tech

Reply via email to