|
From: Narasimha S. <nsh...@us...> - 2012-04-03 00:29:53
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "SFCB - Small Footprint CIM Broker".
The branch, master has been updated
via fc989a07063e91acdc1e7fef35bf466778ffe503 (commit)
from 022cb89d6732224551a3796650f28b9556ac2ccc (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit fc989a07063e91acdc1e7fef35bf466778ffe503
Author: nsharoff <nsharoff@nsharoff.(none)>
Date: Mon Apr 2 17:21:32 2012 -0700
Patches for [ 3486814 , 3462309 , 3485438 ]
-----------------------------------------------------------------------
Summary of changes:
diff --git a/ChangeLog b/ChangeLog
index caae215..7a789d4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2012-04-02 Narasimha Sharoff <nsh...@us...>
+
+ * indCIMXMLHandler.c:
+ [ 3485438 ] Segfault while retrying to deliver an indication
+
+ * sfcBroker.c:
+ [ 3462309 ] Do not allow multiple instances of sfcb
+
+ * cimXmlParser.c:
+ [ 3486814 ] sfcb crashes while freeing the cimxml response
+
2012-04-02 Michael Chase-Salerno <br...@li...>
* cimcClientSfcbLocal.c:
diff --git a/cimXmlParser.c b/cimXmlParser.c
index cd75652..50697f8 100644
--- a/cimXmlParser.c
+++ b/cimXmlParser.c
@@ -1847,7 +1847,9 @@ freeParamValues(XtokParamValues * op)
XtokParamValue *pv = op->first,
*dv;
while (pv) {
- freeParamValue(pv);
+ /* 3486814 : type is invalid, value is null */
+ if (pv->type != USHRT_MAX)
+ freeParamValue(pv);
dv = pv;
pv = pv->next;
free(dv);
diff --git a/indCIMXMLHandler.c b/indCIMXMLHandler.c
index 5110005..c618ca9 100644
--- a/indCIMXMLHandler.c
+++ b/indCIMXMLHandler.c
@@ -736,10 +736,14 @@ dqRetry(CMPIContext * ctx, RTElement * cur)
// queue is empty
free(cur);
RQhead = NULL;
+ RQtail = NULL;
} else {
// not last
cur->prev->next = cur->next;
cur->next->prev = cur->prev;
+ /* 3485438-77204 - update qhead/qtail */
+ if (cur == RQhead) RQhead=cur->next;
+ if (cur == RQtail) RQtail=cur->prev;
CMRelease(cur->ref);
CMRelease(cur->sub);
if (cur)
diff --git a/sfcBroker.c b/sfcBroker.c
index dcf7412..7a62a25 100644
--- a/sfcBroker.c
+++ b/sfcBroker.c
@@ -32,6 +32,12 @@
#include <signal.h>
#include <sys/wait.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <dirent.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
#include "trace.h"
#include "msgqueue.h"
#include <pthread.h>
@@ -504,6 +510,39 @@ usage(int status)
exit(status);
}
+/* SF 3462309 : Check if there is an instance of sfcbd running; use procfs */
+static int
+sfcb_is_running()
+{
+ #define STRBUF_LEN 512
+ #define BUF_LEN 30
+ struct dirent *dp = NULL;
+ char *strbuf = malloc(STRBUF_LEN);
+ char *buf = malloc(BUF_LEN);
+ int mypid = getpid();
+ int ret = 0;
+
+ DIR *dir = opendir("/proc");
+ while ((dp = readdir(dir)) != NULL) {
+ if (isdigit(dp->d_name[0])) {
+ sprintf(buf, "/proc/%s/exe", dp->d_name);
+ memset(strbuf, 0, STRBUF_LEN);
+ if (readlink(buf, strbuf, STRBUF_LEN) == -1) continue;
+ if (strstr(strbuf, "sfcbd") != NULL) {
+ ret = strtol(dp->d_name, NULL, 0);
+ if (ret == mypid) { ret = 0; continue; }
+ break;
+ }
+ }
+ }
+
+ closedir(dir);
+ free(buf);
+ free(strbuf);
+ return(ret);
+}
+
+
static void
version()
{
@@ -537,6 +576,13 @@ main(int argc, char *argv[])
pSockets;
char *pauseStr;
+ /* SF 3462309 - If there is an instance running already, return */
+ int pid_found = 0;
+ if ((pid_found = sfcb_is_running()) != 0) {
+ mlogf(M_ERROR, M_SHOW, " --- A previous instance of sfcbd [%d] is running. Exiting.\n", pid_found);
+ exit(1);
+ }
+
name = strrchr(argv[0], '/');
if (name != NULL)
++name;
hooks/post-receive
--
SFCB - Small Footprint CIM Broker
|