[sr-dev] git:master: mi_fifo: don't delete fifo file in cfg check mode

Daniel-Constantin Mierla miconda at gmail.com
Sun Jul 17 09:55:52 CEST 2011


Module: sip-router
Branch: master
Commit: 0a3fc0da283854b6d25e77f9a1283ee6704e425d
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0a3fc0da283854b6d25e77f9a1283ee6704e425d

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Sun Jul 17 09:54:32 2011 +0200

mi_fifo: don't delete fifo file in cfg check mode

---

 modules_k/mi_fifo/mi_fifo.c |   25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/modules_k/mi_fifo/mi_fifo.c b/modules_k/mi_fifo/mi_fifo.c
index 9530c4c..6598e34 100644
--- a/modules_k/mi_fifo/mi_fifo.c
+++ b/modules_k/mi_fifo/mi_fifo.c
@@ -44,6 +44,7 @@
 #include "../../dprint.h"
 #include "../../ut.h"
 #include "../../pt.h"
+#include "../../globals.h"
 #include "../../mem/mem.h"
 #include "../../mem/shm_mem.h"
 #include "../../cfg/cfg_struct.h"
@@ -123,11 +124,13 @@ static int mi_mod_init(void)
 	LM_DBG("testing mi_fifo existance ...\n");
 	n=stat(mi_fifo, &filestat);
 	if (n==0) {
-		/* FIFO exist, delete it (safer) */
-		if (unlink(mi_fifo)<0){
-			LM_ERR("Cannot delete old MI fifo (%s): %s\n",
-				mi_fifo, strerror(errno));
-			return -1;
+		/* FIFO exist, delete it (safer) if no config check */
+		if(config_check==0) {
+			if (unlink(mi_fifo)<0){
+				LM_ERR("Cannot delete old MI fifo (%s): %s\n",
+					mi_fifo, strerror(errno));
+				return -1;
+			}
 		}
 	} else if (n<0 && errno!=ENOENT){
 		LM_ERR("MI FIFO stat failed: %s\n", strerror(errno));
@@ -256,11 +259,13 @@ static int mi_destroy(void)
 	/* destroying the fifo file */
 	n=stat(mi_fifo, &filestat);
 	if (n==0){
-		/* FIFO exist, delete it (safer) */
-		if (unlink(mi_fifo)<0){
-			LM_ERR("cannot delete the fifo (%s): %s\n",
-				mi_fifo, strerror(errno));
-			goto error;
+		/* FIFO exist, delete it (safer) if not config check */
+		if(config_check==0) {
+			if (unlink(mi_fifo)<0){
+				LM_ERR("cannot delete the fifo (%s): %s\n",
+					mi_fifo, strerror(errno));
+				goto error;
+			}
 		}
 	} else if (n<0 && errno!=ENOENT) {
 		LM_ERR("FIFO stat failed: %s\n", strerror(errno));




More information about the sr-dev mailing list