if (r < 0)
goto ERROR;
+ // Open the source file
+ src = fopen(srcpath, "r");
+ if (!src) {
+ switch (errno) {
+ // If the source file does not exist, we cannot copy anything
+ case ENOENT:
+ goto ERROR;
+
+ default:
+ ERROR(stripper->ctx, "Could not open %s: %m\n", filename);
+ r = -errno;
+ goto ERROR;
+ }
+ }
+
+ // Stat the source file
+ r = fstat(fileno(src), &st);
+ if (r < 0) {
+ ERROR(stripper->ctx, "Could not stat %s: %m\n", filename);
+ r = -errno;
+ goto ERROR;
+ }
+
// Create all directories
r = pakfire_mkparentdir(dstpath, 0755);
if (r < 0)
}
}
- // Open the source file
- src = fopen(srcpath, "r");
- if (!src) {
- ERROR(stripper->ctx, "Could not open %s: %m\n", filename);
- r = -errno;
- goto ERROR;
- }
-
- // Stat the source file
- r = fstat(fileno(src), &st);
- if (r < 0) {
- ERROR(stripper->ctx, "Could not stat %s: %m\n", filename);
- r = -errno;
- goto ERROR;
- }
-
// Copy all content
ssize_t bytes_written = sendfile(fileno(dst), fileno(src), 0, st.st_size);
if (bytes_written < st.st_size) {