summaryrefslogtreecommitdiff
path: root/lib/xchown.c
diff options
context:
space:
mode:
authorMihail Konev <k.mvc@ya.ru>2016-10-04 17:18:18 +0000
committerColin Watson <cjwatson@debian.org>2016-11-20 16:21:49 +0000
commit9ab9f3dd9b0d5f290c635995559332c1710e5b4d (patch)
tree5b93577e180228abca5808b2b538d5d35cba5418 /lib/xchown.c
parent8d82a79d1c7f66cb5d8c104fe5df0de8e58f0e2d (diff)
man(1): Fix gcc warnings
* lib/xchown.c: New file. * lib/xchown.h: New file. * lib/Makefile.am (libman_la_SOURCES): Add xchown.c and xchown.h. * po/POTFILES.in: Add lib/xchown.c. * src/check_mandirs.c (mkcatdirs): Call xchown instead of chown. * src/man.c (format_display): Ignore errors from chdir ("/").
Diffstat (limited to 'lib/xchown.c')
-rw-r--r--lib/xchown.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/xchown.c b/lib/xchown.c
new file mode 100644
index 00000000..760cd748
--- /dev/null
+++ b/lib/xchown.c
@@ -0,0 +1,39 @@
+/*
+ * xchown.c: chown replacement function
+ *
+ * Copyright (C) 2016 Mihail Konev.
+ *
+ * man-db is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * man-db is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with man-db; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif /* HAVE_CONFIG_H */
+
+#include <unistd.h>
+
+#include "gettext.h"
+#define _(String) gettext (String)
+
+#include "error.h"
+#include "manconfig.h"
+
+void xchown (const char *path, uid_t owner, gid_t group)
+{
+ int rc;
+ rc = chown (path, owner, group);
+ if (rc)
+ error (FATAL, 0, _("can't chown %s"), path);
+}