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)
committerLennart Poettering <lennart@poettering.net>
Mon, 2 May 2016 09:15:30 +0000 (11:15 +0200)
src/basic/copy.c

index 3001234..c2baef6 100644 (file)
@@ -305,6 +305,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)