fail in CopyFile if the FileFds have error flag set
[ntk/apt.git] / apt-pkg / contrib / fileutl.cc
index 7c3a302..0f88923 100644 (file)
@@ -184,7 +184,8 @@ bool RunScripts(const char *Cnf)
 /* The caller is expected to set things so that failure causes erasure */
 bool CopyFile(FileFd &From,FileFd &To)
 {
-   if (From.IsOpen() == false || To.IsOpen() == false)
+   if (From.IsOpen() == false || To.IsOpen() == false ||
+        From.Failed() == true || To.Failed() == true)
       return false;
    
    // Buffered copy between fds