Skip to content

Commit

Permalink
maint: Reduce output when rename fails
Browse files Browse the repository at this point in the history
  • Loading branch information
andy5995 committed Oct 31, 2024
1 parent 1c6ca92 commit 6bf8289
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
3 changes: 1 addition & 2 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,7 @@ damage of 5000 hp. You feel satisfied.\n"));
}
}
else
msg_err_rename(argv[file_arg],
st_target.waste_dest_name, __func__, __LINE__);
msg_err_rename(argv[file_arg], st_target.waste_dest_name);

/**
* If we get to this point, it means a WASTE folder was found
Expand Down
10 changes: 4 additions & 6 deletions src/messages_rmw.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,12 @@ msg_err_open_dir(const char *dir, const char *func, const int line)
}

void
msg_err_rename(const char *src_file, const char *dest_file, const char *func,
const int line)
msg_err_rename(const char *src_file, const char *dest_file)
{
print_msg_error();
printf(_("while trying to move (rename)\n\
%s -> %s -- %s:L%d\n"), src_file, dest_file, func, line);
perror("rename()");
exit(errno);
fprintf(stderr, "%s -> %s\n\
rename: %s\n", src_file, dest_file, strerror(errno));
exit(EXIT_FAILURE);
}

/*!
Expand Down
3 changes: 1 addition & 2 deletions src/messages_rmw.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ void msg_err_close_dir(const char *dir, const char *func, const int line);
void msg_err_open_dir(const char *dir, const char *func, const int line);

void
msg_err_rename(const char *src_file, const char *dest_file, const char *func,
const int line);
msg_err_rename(const char *src_file, const char *dest_file);

void msg_err_fatal_fprintf(const char *func);

Expand Down
2 changes: 1 addition & 1 deletion src/restore_rmw.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ Duplicate filename at destination - appending time string...\n"));
}
else
{
msg_err_rename(src, dest, __func__, __LINE__);
msg_err_rename(src, dest);
return rename_res;
}
}
Expand Down

0 comments on commit 6bf8289

Please sign in to comment.