File sblim-cmpi-syslog-0.7.9_testsuite_random_return.patch of Package sblim-cmpi-syslog
Index: syslog-conf/test/system/linux/setting.c
===================================================================
--- syslog-conf/test/system/linux/setting.c.orig
+++ syslog-conf/test/system/linux/setting.c
@@ -4,15 +4,15 @@
#include <string.h>
#define LINE_MAX 2048
-
+
char facility[256], priority[256], path[256], action[256];
FILE *ifp, *ofp = NULL;
int line_max = LINE_MAX;
-
-
+
+
/* Utility function that reads the lines of the conf file and outputs each rule, one per line, to a new temporary file. It calls the function parse_list() to
do this. Returns 0 on success and 1 on error */
-
+
int setting_read()
{
char *cline, *cbuf = NULL;
@@ -20,8 +20,8 @@
int lineno = 0;
int ret = 0;
FILE *fp = NULL;
-
-
+
+
/* opening the temp file, as we do not want to be working on the main syslog
file as of now. The syslog.conf file is copied to a temp file */
fp = fopen("/etc/syslog.conf", "r");
@@ -38,7 +38,7 @@
cline = cbuf;
while ( fgets(cline, line_max, fp) != NULL) {
for (p = cline; isspace(*p); ++p) ;
-
+
if (*p == '\0' || *p == '#') {
lineno++;
continue;
@@ -49,13 +49,13 @@
}
fclose(fp);
free(cbuf);
-
+
return ret;
}
-
+
/* Utility function used by the setting_read function for splitting the setting
rules. Returns 0 on success and 1 on error */
-
+
int parse_list( const char *line )
{
char *bp, *p, *q = NULL;
@@ -64,8 +64,8 @@
char prio[256];
char path[256];
char outbuf[2000];
-
-
+
+
bzero(&buf, sizeof(buf));
bzero(&outbuf, sizeof(outbuf));
bzero(&fac, sizeof(fac));
@@ -78,23 +78,23 @@
while(isspace(*q)) q++;
strcpy(path, q);
path[strlen(path)] = '\n';
-
+
free(p);
p = NULL;
q = NULL;
-
+
for (p=(char *)line; *p && *p != '\t' && *p != ' ';) {
for (q=p; *q && *q != '\t' && *q++ != '.'; ) continue;
for (bp=buf; *q && !strchr("\t ,;", *q); )
*bp++ = *q++;
*bp = '\0';
-
+
while (strchr(",;", *q))
q++;
-
+
bp = buf;
strcpy(prio, bp);
-
+
while (*p && !strchr("\t .;", *p)) {
for (bp=buf; *p && !strchr("\t ,;.", *p); )
*bp++ = *p++;
@@ -111,11 +111,11 @@
}
p = q;
}
-
+
return 0;
}
int main()
{
- setting_read();
+ return(setting_read());
}