diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2025-02-12 16:50:50 -0500 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2025-02-12 16:50:50 -0500 |
commit | e0b9febf0cb210d1d1a23cd366ca20fc936c8eb9 (patch) | |
tree | 2c1e854c266a04bfc1fac1312afa4e8520ab4f42 /src | |
parent | 20fbf33e8bc991b417ab1579404eb6d681599e5c (diff) | |
download | stasis-e0b9febf0cb210d1d1a23cd366ca20fc936c8eb9.tar.gz |
Add debug statements to copy.c
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/core/copy.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/core/copy.c b/src/lib/core/copy.c index 928bc40..25eede3 100644 --- a/src/lib/core/copy.c +++ b/src/lib/core/copy.c @@ -3,6 +3,7 @@ int copy2(const char *src, const char *dest, unsigned int op) { struct stat src_stat, dnamest; + SYSDEBUG("Stat source file: %s", src); if (lstat(src, &src_stat) < 0) { perror(src); return -1; @@ -20,7 +21,9 @@ int copy2(const char *src, const char *dest, unsigned int op) { *dname_endptr = '\0'; } + SYSDEBUG("Stat destination file: %s", dname); stat(dname, &dnamest); + if (S_ISLNK(src_stat.st_mode)) { char lpath[1024] = {0}; if (readlink(src, lpath, sizeof(lpath)) < 0) { @@ -44,12 +47,14 @@ int copy2(const char *src, const char *dest, unsigned int op) { } else if (S_ISREG(src_stat.st_mode)) { char buf[STASIS_BUFSIZ] = {0}; size_t bytes_read; + SYSDEBUG("%s", "Opening source file for reading"); FILE *fp1 = fopen(src, "rb"); if (!fp1) { perror(src); return -1; } + SYSDEBUG("%s", "Opening destination file for writing"); FILE *fp2 = fopen(dest, "w+b"); if (!fp2) { perror(dest); @@ -79,5 +84,6 @@ int copy2(const char *src, const char *dest, unsigned int op) { errno = EOPNOTSUPP; return -1; } + SYSDEBUG("%s", "Data copied"); return 0; } |