2012-01-10 Bruno Haible <bruno@clisp.org>
+ copy-file: Refactor.
+ * lib/copy-file.c: Include quote.h.
+ (copy_file_preserving): Call qcopy_acl instead of copy_acl. Emit error
+ message here.
+ * modules/copy-file (Depends-on): Add quote.
+
acl: Export qcopy_acl.
* lib/acl.h (qcopy_acl): New declaration.
* lib/copy-acl.c (qcopy_acl): Make non-static.
#include "full-write.h"
#include "acl.h"
#include "binary-io.h"
+#include "quote.h"
#include "gettext.h"
#include "xalloc.h"
/* Preserve the access permissions. */
#if USE_ACL
- if (copy_acl (src_filename, src_fd, dest_filename, dest_fd, mode))
- exit (EXIT_FAILURE);
+ switch (qcopy_acl (src_filename, src_fd, dest_filename, dest_fd, mode))
+ {
+ case -2:
+ error (EXIT_FAILURE, errno, "%s", quote (src_filename));
+ case -1:
+ error (EXIT_FAILURE, errno, _("preserving permissions for %s"),
+ quote (dest_filename));
+ }
#else
chmod (dest_filename, mode);
#endif