Fix removing destinations when it's not the last or only destination...

This commit is contained in:
Nils O. Selåsdal
2012-11-05 21:07:13 +01:00
parent 2b85b3865f
commit 56eb4b84b4
2 changed files with 12 additions and 6 deletions
+11 -5
View File
@@ -195,14 +195,20 @@ START_TEST (test_logfile_remove_dest)
.cnt = 1,
};
struct stat st;
struct uc_log_destination *dest;
struct uc_log_destination *dest1, *dest2;
int rc;
uc_log_init(&mods);
dest = uc_log_new_file(file_name, UC_LL_DEBUG, 1);
fail_if(dest == NULL);
uc_log_add_destination(dest);
dest1 = uc_log_new_file(file_name, UC_LL_DEBUG, 1);
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);
@@ -211,7 +217,7 @@ START_TEST (test_logfile_remove_dest)
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
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