Mercurial > hg > octave-lyh > gnulib-hg
changeset 16271:a9b070c205b2
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.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Wed, 11 Jan 2012 02:01:45 +0100 |
parents | a81fb44bbdeb |
children | 8e1f4b31c39f |
files | ChangeLog lib/copy-file.c modules/copy-file |
diffstat | 3 files changed, 16 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 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.
--- a/lib/copy-file.c +++ b/lib/copy-file.c @@ -41,6 +41,7 @@ #include "full-write.h" #include "acl.h" #include "binary-io.h" +#include "quote.h" #include "gettext.h" #include "xalloc.h" @@ -122,8 +123,14 @@ /* 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