re-mark 1.29b-2 as not yet uploaded (merge madness!)
[debian/tar] / gnu / copy-acl.c
1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* copy-acl.c - copy access control list from one file to another file
4
5    Copyright (C) 2002-2003, 2005-2014 Free Software Foundation, Inc.
6
7    This program is free software: you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 3 of the License, or
10    (at your option) any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
20    Written by Paul Eggert, Andreas Grünbacher, and Bruno Haible.  */
21
22 #include <config.h>
23
24 #include "acl.h"
25
26 #include <errno.h>
27
28 #include "quote.h"
29 #include "error.h"
30 #include "gettext.h"
31 #define _(msgid) gettext (msgid)
32
33
34 /* Copy access control lists from one file to another. If SOURCE_DESC is
35    a valid file descriptor, use file descriptor operations, else use
36    filename based operations on SRC_NAME. Likewise for DEST_DESC and
37    DST_NAME.
38    If access control lists are not available, fchmod the target file to
39    MODE.  Also sets the non-permission bits of the destination file
40    (S_ISUID, S_ISGID, S_ISVTX) to those from MODE if any are set.
41    Return 0 if successful, otherwise output a diagnostic and return a
42    negative error code.  */
43
44 int
45 copy_acl (const char *src_name, int source_desc, const char *dst_name,
46           int dest_desc, mode_t mode)
47 {
48   int ret = qcopy_acl (src_name, source_desc, dst_name, dest_desc, mode);
49   switch (ret)
50     {
51     case -2:
52       error (0, errno, "%s", quote (src_name));
53       break;
54
55     case -1:
56       error (0, errno, _("preserving permissions for %s"), quote (dst_name));
57       break;
58
59     default:
60       break;
61     }
62   return ret;
63 }