|
|
@@ -166,15 +166,37 @@ static int logsys_config_file_set_unlocked (
|
|
|
return (0);
|
|
|
}
|
|
|
|
|
|
+ if (logsys_loggers[subsysid].target_id > 0 &&
|
|
|
+ logsys_loggers[subsysid].logfile != NULL &&
|
|
|
+ strcmp(file, logsys_loggers[subsysid].logfile) == 0) {
|
|
|
+ return (0);
|
|
|
+ }
|
|
|
+
|
|
|
if (strlen(file) >= PATH_MAX) {
|
|
|
snprintf (error_string_response,
|
|
|
sizeof(error_string_response),
|
|
|
- "%s: logfile name exceed maximum system filename lenght",
|
|
|
+ "%s: logfile name exceed maximum system filename length",
|
|
|
logsys_loggers[subsysid].subsys);
|
|
|
*error_string = error_string_response;
|
|
|
return (-1);
|
|
|
}
|
|
|
|
|
|
+ if (logsys_loggers[subsysid].logfile != NULL) {
|
|
|
+ free(logsys_loggers[subsysid].logfile);
|
|
|
+ logsys_loggers[subsysid].logfile = NULL;
|
|
|
+ }
|
|
|
+
|
|
|
+ logsys_loggers[subsysid].logfile = strdup(file);
|
|
|
+
|
|
|
+ if (logsys_loggers[subsysid].logfile == NULL) {
|
|
|
+ snprintf (error_string_response,
|
|
|
+ sizeof(error_string_response),
|
|
|
+ "Unable to allocate memory for logfile '%s'",
|
|
|
+ file);
|
|
|
+ *error_string = error_string_response;
|
|
|
+ return (-1);
|
|
|
+ }
|
|
|
+
|
|
|
for (i = 0; i <= LOGSYS_MAX_SUBSYS_COUNT; i++) {
|
|
|
if ((logsys_loggers[i].logfile != NULL) &&
|
|
|
(strcmp (logsys_loggers[i].logfile, file) == 0) &&
|
|
|
@@ -186,15 +208,6 @@ static int logsys_config_file_set_unlocked (
|
|
|
return (0);
|
|
|
}
|
|
|
}
|
|
|
- logsys_loggers[subsysid].logfile = strdup(file);
|
|
|
- if (logsys_loggers[subsysid].logfile == NULL) {
|
|
|
- snprintf (error_string_response,
|
|
|
- sizeof(error_string_response),
|
|
|
- "Unable to allocate memory for logfile '%s'",
|
|
|
- file);
|
|
|
- *error_string = error_string_response;
|
|
|
- return (-1);
|
|
|
- }
|
|
|
|
|
|
if (logsys_loggers[subsysid].target_id > 0) {
|
|
|
int num_using_current = 0;
|