Fix removing destinations when it's not the last or only destination...
This commit is contained in:
+1
-1
@@ -186,7 +186,7 @@ static inline void uc_log_remove_dest_unlocked(struct uc_log_destination *dest)
|
|||||||
|
|
||||||
//check that it's not already removed
|
//check that it's not already removed
|
||||||
SLIST_FOREACH(it, &destinations, entry) {
|
SLIST_FOREACH(it, &destinations, entry) {
|
||||||
if(it == dest);
|
if(it == dest)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+11
-5
@@ -195,14 +195,20 @@ START_TEST (test_logfile_remove_dest)
|
|||||||
.cnt = 1,
|
.cnt = 1,
|
||||||
};
|
};
|
||||||
struct stat st;
|
struct stat st;
|
||||||
struct uc_log_destination *dest;
|
struct uc_log_destination *dest1, *dest2;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
uc_log_init(&mods);
|
uc_log_init(&mods);
|
||||||
|
|
||||||
dest = uc_log_new_file(file_name, UC_LL_DEBUG, 1);
|
|
||||||
fail_if(dest == NULL);
|
dest1 = uc_log_new_file(file_name, UC_LL_DEBUG, 1);
|
||||||
uc_log_add_destination(dest);
|
fail_if(dest1 == NULL);
|
||||||
|
|
||||||
|
dest2 = uc_log_new_stderr(UC_LL_WARNING, 1);
|
||||||
|
fail_if(dest2 == NULL);
|
||||||
|
|
||||||
|
uc_log_add_destination(dest1);
|
||||||
|
uc_log_add_destination(dest2);
|
||||||
|
|
||||||
UC_LOGF(UC_LL_DEBUG, 0, "Lorum ipson %d\n", 1);
|
UC_LOGF(UC_LL_DEBUG, 0, "Lorum ipson %d\n", 1);
|
||||||
UC_LOGF(UC_LL_DEBUG, 0, "Lorum ipson %d\n", 1);
|
UC_LOGF(UC_LL_DEBUG, 0, "Lorum ipson %d\n", 1);
|
||||||
@@ -211,7 +217,7 @@ START_TEST (test_logfile_remove_dest)
|
|||||||
fail_if(rc != 0, "stat failed: %s\n", strerror(errno));
|
fail_if(rc != 0, "stat failed: %s\n", strerror(errno));
|
||||||
fail_if(st.st_size != 80*2, "was %ld\n", (long)st.st_size);//should be 82 chars per log statement
|
fail_if(st.st_size != 80*2, "was %ld\n", (long)st.st_size);//should be 82 chars per log statement
|
||||||
|
|
||||||
uc_log_remove_destination(dest);
|
uc_log_remove_destination(dest1);
|
||||||
|
|
||||||
UC_LOGF(UC_LL_DEBUG, 0, "Lorum ipson %d\n", 1); //should not be logged now
|
UC_LOGF(UC_LL_DEBUG, 0, "Lorum ipson %d\n", 1); //should not be logged now
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user