]> arthur.barton.de Git - netatalk.git/commitdiff
copy_file, check close(destination) return value for error
authordidg <didg>
Fri, 16 Oct 2009 00:57:12 +0000 (00:57 +0000)
committerdidg <didg>
Fri, 16 Oct 2009 00:57:12 +0000 (00:57 +0000)
libatalk/vfs/unix.c

index 1760c645d0836ea17ff8b7107c25b59549a8e8bc..3b71dec206a8a59c0c11603395f4a58b5575d5c7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: unix.c,v 1.4 2009-10-16 00:48:08 didg Exp $
+ * $Id: unix.c,v 1.5 2009-10-16 00:57:12 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -204,8 +204,18 @@ int copy_file(const char *src, const char *dst, mode_t mode)
 exit:
     if (sfd != -1)
         close(sfd);
-    if (dfd != -1)
-        close(dfd);
+
+    if (dfd != -1) {
+        int err;
+
+        err = close(dfd);
+        if (!ret && err) {
+            /* don't bother to report an error if there's already one */
+            LOG(log_error, logtype_afpd, "copy_file('%s'/'%s'): close '%s' error: %s",
+                    src, dst, dst, strerror(errno));
+            ret = -1;
+        }
+    }
 
     return ret;
 }