long long range = params->progress_to - params->progress_from;
size_t count = params->partsize;
double percentage;
+ int ret = 0;
+ char err_str[256] = { 0 };
__attribute__((cleanup(fd_cleanup))) int fd_src = open(params->src, O_RDONLY);
return ERR_DST_OPEN;
}
- errno = posix_fadvise(fd_src, 0, 0, POSIX_FADV_SEQUENTIAL);
- if (errno != 0)
- fprintf(stderr, "Cannot call posix_fadvise for src: %m\n");
+ ret = posix_fadvise(fd_src, 0, 0, POSIX_FADV_SEQUENTIAL);
+ if (ret != 0) {
+ strerror_r(ret, err_str, sizeof(err_str));
+ fprintf(stderr, "Cannot call posix_fadvise for src: %s(%d)\n", err_str, ret);
+ }
- errno = posix_fadvise(fd_dst, 0, 0, POSIX_FADV_SEQUENTIAL);
- if (errno != 0)
- fprintf(stderr, "Cannot call posix_fadvise for dst: %m\n");
+ ret = posix_fadvise(fd_dst, 0, 0, POSIX_FADV_SEQUENTIAL);
+ if (ret != 0) {
+ strerror_r(ret, err_str, sizeof(err_str));
+ fprintf(stderr, "Cannot call posix_fadvise for dst: %s(%d)\n", err_str, ret);
+ }
fprintf(stderr, "%s -> %s: %3d%% (%3d%% overall)", params->src, params->dst, 0, (int) params->progress_from);