Blob Blame History Raw
diff -up opencryptoki-3.11.0/usr/lib/api/apiutil.c.coverity opencryptoki-3.11.0/usr/lib/api/apiutil.c
--- opencryptoki-3.11.0/usr/lib/api/apiutil.c.coverity	2018-11-16 15:53:03.000000000 +0100
+++ opencryptoki-3.11.0/usr/lib/api/apiutil.c	2019-02-21 11:56:00.131624101 +0100
@@ -51,16 +51,12 @@ extern API_Proc_Struct_t *Anchor;
 
 CK_RV CreateProcLock(void)
 {
-    struct stat statbuf;
-
     if (xplfd == -1) {
 
         /* The slot mgr daemon should have already created lock,
          * so just open it so we can get a lock...
          */
-        if (stat(OCK_API_LOCK_FILE, &statbuf) == 0)
-            xplfd = open(OCK_API_LOCK_FILE, O_RDONLY);
-
+        xplfd = open(OCK_API_LOCK_FILE, O_RDONLY);
         if (xplfd == -1) {
             OCK_SYSLOG(LOG_ERR, "Could not open %s\n", OCK_API_LOCK_FILE);
             return CKR_FUNCTION_FAILED;
diff -up opencryptoki-3.11.0/usr/sbin/pkcsslotd/mutex.c.coverity opencryptoki-3.11.0/usr/sbin/pkcsslotd/mutex.c
--- opencryptoki-3.11.0/usr/sbin/pkcsslotd/mutex.c.coverity	2018-11-16 15:53:03.000000000 +0100
+++ opencryptoki-3.11.0/usr/sbin/pkcsslotd/mutex.c	2019-02-21 11:47:52.097612395 +0100
@@ -26,15 +26,10 @@ int CreateXProcLock(void)
 {
     struct group *grp;
     mode_t mode = (S_IRUSR | S_IRGRP);
-    struct stat statbuf;
 
     if (xplfd == -1) {
-        if (stat(OCK_API_LOCK_FILE, &statbuf) == 0) {
-            xplfd = open(OCK_API_LOCK_FILE, O_RDONLY, mode);
-        } else {
-            xplfd = open(OCK_API_LOCK_FILE, O_CREAT | O_RDONLY, mode);
-
-            if (xplfd != -1) {
+        xplfd = open(OCK_API_LOCK_FILE, O_CREAT | O_RDONLY, mode);
+        if (xplfd != -1) {
                 if (fchmod(xplfd, mode) == -1) {
                     DbgLog(DL0, "%s:fchmod(%s):%s\n",
                            __func__, OCK_API_LOCK_FILE, strerror(errno));
@@ -54,9 +49,7 @@ int CreateXProcLock(void)
                            __func__, strerror(errno));
                     goto error;
                 }
-            }
-        }
-        if (xplfd == -1) {
+        } else {
             DbgLog(DL0, "open(%s): %s\n", OCK_API_LOCK_FILE, strerror(errno));
             return FALSE;
         }