|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
commit 7a7226543611897103c7483bec160547294dcf0d
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
Author: Alexandra Hájková <ahajkova@redhat.com>
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
Date: Sat Dec 26 20:44:34 2020 +0100
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
Add xfchmod to libsupport
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
diff --git a/support/Makefile b/support/Makefile
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
index d2b95539403e416c..4875f52495ef292d 100644
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
--- a/support/Makefile
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
+++ b/support/Makefile
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
@@ -91,6 +91,7 @@ libsupport-routines = \
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
xdlfcn \
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
xdlmopen \
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
xdup2 \
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
+ xfchmod \
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
xfclose \
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
xfopen \
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
xfork \
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
diff --git a/support/xfchmod.c b/support/xfchmod.c
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
new file mode 100644
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
index 0000000000000000..4323b9ca8e078c98
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
--- /dev/null
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
+++ b/support/xfchmod.c
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
@@ -0,0 +1,28 @@
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
+/* fchmod with error checking.
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
+ Copyright (C) 2021 Free Software Foundation, Inc.
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
+ This file is part of the GNU C Library.
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
+
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
+ modify it under the terms of the GNU Lesser General Public
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
+ License as published by the Free Software Foundation; either
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
+ version 2.1 of the License, or (at your option) any later version.
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
+
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
+ Lesser General Public License for more details.
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
+
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
+ You should have received a copy of the GNU Lesser General Public
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
+ License along with the GNU C Library; if not, see
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
+ <https://www.gnu.org/licenses/>. */
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
+
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
+#include <support/check.h>
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
+#include <support/xunistd.h>
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
+#include <sys/stat.h>
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
+
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
+void
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
+xfchmod (int fd, mode_t mode)
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
+{
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
+ if (fchmod (fd, mode) != 0)
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
+ FAIL_EXIT1 ("fchmod (%d, 0%o): %m", fd, mode);
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
+}
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
diff --git a/support/xunistd.h b/support/xunistd.h
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
index 74fd2771d12c36fe..ced8cb1dd9ee356c 100644
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
--- a/support/xunistd.h
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
+++ b/support/xunistd.h
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
@@ -45,6 +45,7 @@ long long xlseek (int fd, long long offset, int whence);
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
void xftruncate (int fd, long long length);
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
void xsymlink (const char *target, const char *linkpath);
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
void xchdir (const char *path);
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
+void xfchmod (int fd, mode_t mode);
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
/* Equivalent of "mkdir -p". */
|
|
![](https://seccdn.libravatar.org/avatar/fcc0873d860f7e6944b3abea5b6b447609288dcd55d37b92d3e9e9b1a1e81f06?s=16&d=retro) |
28653a |
void xmkdirp (const char *, mode_t);
|