OpenCoverage

copy-acl.c

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

Generated by Squish Coco 4.1.2