Module: sip-router
Branch: master
Commit: 3ad92e15ad31f27513de21c8ced4d243643b7cad
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=3ad92e1…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Sun Jul 17 09:55:13 2011 +0200
mi_datagram: don't delete unixsock file in cfg check mode
---
modules_k/mi_datagram/mi_datagram.c | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/modules_k/mi_datagram/mi_datagram.c b/modules_k/mi_datagram/mi_datagram.c
index 0e2f303..d36af3e 100644
--- a/modules_k/mi_datagram/mi_datagram.c
+++ b/modules_k/mi_datagram/mi_datagram.c
@@ -56,6 +56,7 @@
#include "../../lib/kmi/mi.h"
#include "../../ip_addr.h"
#include "../../pt.h"
+#include "../../globals.h"
#include "../../cfg/cfg_struct.h"
#include "mi_datagram.h"
#include "datagram_fnc.h"
@@ -218,9 +219,11 @@ static int mi_mod_init(void)
n=stat(mi_socket, &filestat);
if( n==0) {
LM_INFO("the socket %s already exists, trying to delete it...\n",
mi_socket);
- if (unlink(mi_socket)<0) {
- LM_ERR("cannot delete old socket: %s\n", strerror(errno));
- return -1;
+ if(config_check==0) {
+ if (unlink(mi_socket)<0) {
+ LM_ERR("cannot delete old socket: %s\n", strerror(errno));
+ return -1;
+ }
}
} else if (n<0 && errno!=ENOENT) {
LM_ERR("socket stat failed:%s\n", strerror(errno));
@@ -364,10 +367,12 @@ static int mi_destroy(void)
if(mi_socket_domain == AF_UNIX) {
n=stat(mi_socket, &filestat);
if (n==0) {
- if (unlink(mi_socket)<0){
- LM_ERR("cannot delete the socket (%s): %s\n",
+ if(config_check==0) {
+ if (unlink(mi_socket)<0){
+ LM_ERR("cannot delete the socket (%s): %s\n",
mi_socket, strerror(errno));
- goto error;
+ goto error;
+ }
}
} else if (n<0 && errno!=ENOENT) {
LM_ERR("socket stat failed: %s\n", strerror(errno));