fix logging bug
This commit is contained in:
@@ -54,6 +54,9 @@ HiResult file_copy(const char *srcname, const char *destination) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
// BUG: Maybe. Sometimes the copied file is 0 bytes with no clear errors.
|
||||
// Maybe bytes_read ends up being 0 without it being an error condition,
|
||||
// so ferror doesn't get flagged.
|
||||
char buffer[HI_FILE_BUFFER_SIZE];
|
||||
size_t bytes_read = 0;
|
||||
while ((bytes_read = fread(buffer, 1, sizeof buffer, src)) > 0) {
|
||||
@@ -64,7 +67,7 @@ HiResult file_copy(const char *srcname, const char *destination) {
|
||||
}
|
||||
|
||||
if (ferror(src)) {
|
||||
log_error("Error reading from source: %s\n");
|
||||
log_error("Error reading from source: %s\n", strerror(errno));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
||||
@@ -215,8 +215,8 @@ int hi_init(size_t n, const char **enabled_modules) {
|
||||
fprintf(stderr, "Failed to init logger.\n");
|
||||
return 1;
|
||||
}
|
||||
log_set_level("DEBUG");
|
||||
log_set_thread_name("Main");
|
||||
log_set_level("WARNING");
|
||||
log_set_thread_name("Hiload");
|
||||
|
||||
// Start the filewatcher
|
||||
context.filewatcher = filewatcher_create();
|
||||
|
||||
Reference in New Issue
Block a user