chiark / gitweb /
copy: return the right error when we can't open a file
authorLennart Poettering <lennart@poettering.net>
Fri, 29 Apr 2016 17:42:07 +0000 (19:42 +0200)
committerSven Eden <yamakuzure@gmx.net>
Fri, 16 Jun 2017 08:12:58 +0000 (10:12 +0200)
src/basic/copy.c

index 397a947..24e03a7 100644 (file)
@@ -267,6 +267,8 @@ static int fd_copy_directory(
                 fdf = openat(df, from, O_RDONLY|O_DIRECTORY|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW);
         else
                 fdf = fcntl(df, F_DUPFD_CLOEXEC, 3);
+        if (fdf < 0)
+                return -errno;
 
         d = fdopendir(fdf);
         if (!d)