Hi Anders,

yes, I'll change to you suggestion.

/Thanks HansN


On 04/06/2018 04:10 PM, Anders Widell wrote:
Ack with minor comment: instead of calling access(), you could maybe simply check for the ENOENT errno value from unlink()?

regards,

Anders Widell


On 04/05/2018 11:53 AM, Hans Nordeback wrote:
---
  src/nid/agent/nid_ipc.c | 9 ++++++++-
  1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/nid/agent/nid_ipc.c b/src/nid/agent/nid_ipc.c
index 4f43cd309..1a77fd8e2 100644
--- a/src/nid/agent/nid_ipc.c
+++ b/src/nid/agent/nid_ipc.c
@@ -28,6 +28,7 @@
    #include <sys/types.h>
  #include <sys/stat.h>
+#include <unistd.h>
  #include "osaf/configmake.h"
    #include "nid/agent/nid_api.h"
@@ -56,7 +57,13 @@ uint32_t nid_create_ipc(char *strbuf)
      mode_t mask;
        /* Lets Remove any such file if it already exists */
-    unlink(NID_FIFO);
+    if (access(NID_FIFO, F_OK ) != -1 ) {
+        if (unlink(NID_FIFO) < 0) {
+            sprintf(strbuf, " FAILURE: Unable To Delete FIFO Error: %s\n",
+                strerror(errno));
+            return NCSCC_RC_FAILURE;
+        }
+    }
        mask = umask(0);



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to