Skip to content

Commit

Permalink
Add explanatory log messages when copying a file failed
Browse files Browse the repository at this point in the history
  • Loading branch information
victoryforce committed Nov 26, 2024
1 parent f20395a commit fe99016
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/common/utility.c
Original file line number Diff line number Diff line change
Expand Up @@ -934,11 +934,26 @@ void dt_copy_file(const char *const sourcefile, const char *destination)

content = (char *)g_try_malloc_n(filesize, sizeof(char));
if(content == NULL)
{
dt_print(DT_DEBUG_ALWAYS,
"[dt_copy_file] failure to allocate memory for copying file '%s'",
sourcefile);
goto END;
}
if(fread(content, sizeof(char), filesize, fin) != filesize)
{
dt_print(DT_DEBUG_ALWAYS,
"[dt_copy_file] error reading file '%s' for copying",
sourcefile);
goto END;
}
if(fwrite(content, sizeof(char), filesize, fout) != filesize)
{
dt_print(DT_DEBUG_ALWAYS,
"[dt_copy_file] error writing file '%s' during copying",
destination);
goto END;
}
}

END:
Expand Down

0 comments on commit fe99016

Please sign in to comment.