unsigned char *buffer;
ssize_t r;
size_t l1;
- mode_t oldmask;
source_handle = fopen(source_file, "r");
if (!source_handle) {
return -1;
}
- oldmask = umask(0644);
destination_fd = mkstemp(template);
- umask(oldmask);
if (destination_fd < 0) {
- pb_log("%s: unable to create temp file, %m\n", __func__);
+ pb_log_fn("unable to create temp file, %m\n");
fclose(source_handle);
return -1;
}
destination_handle = fdopen(destination_fd, "w");
if (!destination_handle) {
- pb_log("%s: unable to open destination file, %m\n", __func__);
+ pb_log_fn("unable to open destination file, %m\n");
fclose(source_handle);
close(destination_fd);
return -1;
if (ferror(destination_handle)) {
/* General error */
result = -1;
- pb_log("%s: failed: unknown fault\n", __func__);
+ pb_log_fn("failed: unknown fault\n");
}
else {
/* No space on destination device */