Skip to content

Commit

Permalink
improve error messages in nfs-cp
Browse files Browse the repository at this point in the history
Signed-off-by: Ronnie Sahlberg <[email protected]>
  • Loading branch information
sahlberg committed Sep 20, 2024
1 parent e0a9a5f commit d6ead62
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions utils/nfs-cp.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ WSADATA wsaData;
#include <unistd.h>
#endif

#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <sys/types.h>
#include <fcntl.h>
#include "libnfs.h"
Expand Down Expand Up @@ -264,15 +266,16 @@ int main(int argc, char *argv[])
}
count = file_pread(src, buf, count, off);
if (count < 0) {
fprintf(stderr, "Failed to read from source file\n");
fprintf(stderr, "Failed to read from source file (%s)\n",
src->is_nfs ? nfs_get_error(src->nfs) : strerror(errno));
free_file_context(src);
free_file_context(dst);
return 10;
}
count = file_pwrite(dst, buf, count, off);
if (count < 0) {
fprintf(stderr, "Failed to write to dest file %s\n",
dst->is_nfs ? nfs_get_error(dst->nfs) : "");
fprintf(stderr, "Failed to write to dest file (%s)\n",
dst->is_nfs ? nfs_get_error(dst->nfs) : strerror(errno));
free_file_context(src);
free_file_context(dst);
return 10;
Expand Down

0 comments on commit d6ead62

Please sign in to comment.