This patch fixes one exit path error handling in logsys_format_set
and add 2 error checks when returning from
logsys_config_file_set_unlocked.
Fabio
Index: exec/logsys.c
===================================================================
--- exec/logsys.c (revision 2093)
+++ exec/logsys.c (working copy)
@@ -805,7 +805,10 @@
logsys_loggers[i].debug = debug;
if ((logfile) && strlen(logfile) > 0) {
- logsys_config_file_set_unlocked (i, &errstr, logfile);
+ if (logsys_config_file_set_unlocked (i, &errstr, logfile) < 0) {
+ pthread_mutex_unlock (&logsys_config_mutex);
+ return (-1);
+ }
}
logsys_loggers[i].logfile_priority = logfile_priority;
@@ -1226,9 +1229,11 @@
}
} else {
for (i = 0; i <= LOGSYS_MAX_SUBSYS_COUNT; i++) {
- logsys_config_file_set_unlocked(i, error_string, file);
+ res = logsys_config_file_set_unlocked(i, error_string, file);
+ if (res < 0) {
+ break;
+ }
}
- res = 0;
}
pthread_mutex_unlock (&logsys_config_mutex);
@@ -1248,13 +1253,14 @@
if (format) {
format_buffer = strdup(format);
- if (format_buffer == NULL) {
- ret = -1;
- }
} else {
format_buffer = strdup("[%6s] %b");
}
+ if (format_buffer == NULL) {
+ ret = -1;
+ }
+
pthread_mutex_unlock (&logsys_config_mutex);
return ret;
}
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais