Preserve errno if opening log file fails
This commit is contained in:
@@ -192,9 +192,11 @@ struct uc_log_destination *uc_log_new_file(const char *filename, int log_level,
|
||||
|
||||
f = fopen(filename, "a");
|
||||
if (f == NULL) {
|
||||
int saved_errno = errno;
|
||||
free(dest->module_settings);
|
||||
free(name);
|
||||
free(dest);
|
||||
errno = saved_errno;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user