summaryrefslogtreecommitdiff
path: root/release/src/router/busybox/coreutils/libcoreutils
diff options
context:
space:
mode:
Diffstat (limited to 'release/src/router/busybox/coreutils/libcoreutils')
-rw-r--r--release/src/router/busybox/coreutils/libcoreutils/Kbuild12
-rw-r--r--release/src/router/busybox/coreutils/libcoreutils/Makefile30
-rwxr-xr-xrelease/src/router/busybox/coreutils/libcoreutils/Makefile.in32
-rw-r--r--release/src/router/busybox/coreutils/libcoreutils/coreutils.h18
-rw-r--r--release/src/router/busybox/coreutils/libcoreutils/cp_mv_stat.c17
-rw-r--r--release/src/router/busybox/coreutils/libcoreutils/getopt_mk_fifo_nod.c29
-rw-r--r--release/src/router/busybox/coreutils/libcoreutils/xgetoptfile_sort_uniq.c38
7 files changed, 52 insertions, 124 deletions
diff --git a/release/src/router/busybox/coreutils/libcoreutils/Kbuild b/release/src/router/busybox/coreutils/libcoreutils/Kbuild
new file mode 100644
index 00000000..755d01f8
--- /dev/null
+++ b/release/src/router/busybox/coreutils/libcoreutils/Kbuild
@@ -0,0 +1,12 @@
+# Makefile for busybox
+#
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
+#
+# Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
+
+lib-y:=
+lib-$(CONFIG_MKFIFO) += getopt_mk_fifo_nod.o
+lib-$(CONFIG_MKNOD) += getopt_mk_fifo_nod.o
+lib-$(CONFIG_INSTALL) += cp_mv_stat.o
+lib-$(CONFIG_CP) += cp_mv_stat.o
+lib-$(CONFIG_MV) += cp_mv_stat.o
diff --git a/release/src/router/busybox/coreutils/libcoreutils/Makefile b/release/src/router/busybox/coreutils/libcoreutils/Makefile
deleted file mode 100644
index b3a4e79b..00000000
--- a/release/src/router/busybox/coreutils/libcoreutils/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-# Makefile for busybox
-#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
-#
-# This program 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.
-#
-# This program 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 this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-
-TOPDIR:= ../../
-LIBCOREUTILS_DIR:=./
-include $(TOPDIR).config
-include $(TOPDIR)Rules.mak
-include Makefile.in
-all: $(libraries-y)
--include $(TOPDIR).depend
-
-clean:
- rm -f *.o *.a $(AR_TARGET)
-
diff --git a/release/src/router/busybox/coreutils/libcoreutils/Makefile.in b/release/src/router/busybox/coreutils/libcoreutils/Makefile.in
deleted file mode 100755
index a7481d40..00000000
--- a/release/src/router/busybox/coreutils/libcoreutils/Makefile.in
+++ /dev/null
@@ -1,32 +0,0 @@
-# Makefile for busybox
-#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
-#
-# This program 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.
-#
-# This program 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 this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-
-LIBCOREUTILS_AR:=libcoreutils.a
-ifndef $(LIBCOREUTILS_DIR)
-LIBCOREUTILS_DIR:=$(TOPDIR)coreutils/libcoreutils/
-endif
-
-LIBCOREUTILS_SRC:= cp_mv_stat.c getopt_mk_fifo_nod.c xgetoptfile_sort_uniq.c
-
-LIBCOREUTILS_OBJS=$(patsubst %.c,$(LIBCOREUTILS_DIR)%.o, $(LIBCOREUTILS_SRC))
-
-libraries-y+=$(LIBCOREUTILS_DIR)$(LIBCOREUTILS_AR)
-
-$(LIBCOREUTILS_DIR)$(LIBCOREUTILS_AR): $(LIBCOREUTILS_OBJS)
- $(AR) -ro $@ $(LIBCOREUTILS_OBJS)
diff --git a/release/src/router/busybox/coreutils/libcoreutils/coreutils.h b/release/src/router/busybox/coreutils/libcoreutils/coreutils.h
index eabca820..99b67b14 100644
--- a/release/src/router/busybox/coreutils/libcoreutils/coreutils.h
+++ b/release/src/router/busybox/coreutils/libcoreutils/coreutils.h
@@ -1,12 +1,20 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
+ */
+
#ifndef COREUTILS_H
-#define COREUTILS_H 1
+#define COREUTILS_H 1
+
+PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
typedef int (*stat_func)(const char *fn, struct stat *ps);
-extern int cp_mv_stat2(const char *fn, struct stat *fn_stat, stat_func sf);
-extern int cp_mv_stat(const char *fn, struct stat *fn_stat);
+int cp_mv_stat2(const char *fn, struct stat *fn_stat, stat_func sf) FAST_FUNC;
+int cp_mv_stat(const char *fn, struct stat *fn_stat) FAST_FUNC;
+
+mode_t getopt_mk_fifo_nod(char **argv) FAST_FUNC;
-extern mode_t getopt_mk_fifo_nod(int argc, char **argv);
-extern FILE *xgetoptfile_sort_uniq(char **argv, const char *mode);
+POP_SAVED_FUNCTION_VISIBILITY
#endif
diff --git a/release/src/router/busybox/coreutils/libcoreutils/cp_mv_stat.c b/release/src/router/busybox/coreutils/libcoreutils/cp_mv_stat.c
index 5a70b022..0fd467c3 100644
--- a/release/src/router/busybox/coreutils/libcoreutils/cp_mv_stat.c
+++ b/release/src/router/busybox/coreutils/libcoreutils/cp_mv_stat.c
@@ -20,26 +20,31 @@
*
*/
-#include <errno.h>
-#include <sys/stat.h>
#include "libbb.h"
#include "coreutils.h"
-extern int cp_mv_stat2(const char *fn, struct stat *fn_stat, stat_func sf)
+int FAST_FUNC cp_mv_stat2(const char *fn, struct stat *fn_stat, stat_func sf)
{
if (sf(fn, fn_stat) < 0) {
if (errno != ENOENT) {
- bb_perror_msg("unable to stat `%s'", fn);
+#if ENABLE_FEATURE_VERBOSE_CP_MESSAGE
+ if (errno == ENOTDIR) {
+ bb_error_msg("cannot stat '%s': Path has non-directory component", fn);
+ return -1;
+ }
+#endif
+ bb_perror_msg("cannot stat '%s'", fn);
return -1;
}
return 0;
- } else if (S_ISDIR(fn_stat->st_mode)) {
+ }
+ if (S_ISDIR(fn_stat->st_mode)) {
return 3;
}
return 1;
}
-extern int cp_mv_stat(const char *fn, struct stat *fn_stat)
+int FAST_FUNC cp_mv_stat(const char *fn, struct stat *fn_stat)
{
return cp_mv_stat2(fn, fn_stat, stat);
}
diff --git a/release/src/router/busybox/coreutils/libcoreutils/getopt_mk_fifo_nod.c b/release/src/router/busybox/coreutils/libcoreutils/getopt_mk_fifo_nod.c
index 0872bdcf..ba3222e4 100644
--- a/release/src/router/busybox/coreutils/libcoreutils/getopt_mk_fifo_nod.c
+++ b/release/src/router/busybox/coreutils/libcoreutils/getopt_mk_fifo_nod.c
@@ -20,26 +20,29 @@
*
*/
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
#include "libbb.h"
#include "coreutils.h"
-extern mode_t getopt_mk_fifo_nod(int argc, char **argv)
+mode_t FAST_FUNC getopt_mk_fifo_nod(char **argv)
{
mode_t mode = 0666;
+ char *smode = NULL;
+#if ENABLE_SELINUX
+ security_context_t scontext;
+#endif
int opt;
+ opt = getopt32(argv, "m:" USE_SELINUX("Z:"), &smode USE_SELINUX(,&scontext));
+ if (opt & 1) {
+ if (bb_parse_mode(smode, &mode))
+ umask(0);
+ }
- while ((opt = getopt(argc, argv, "m:")) > 0) {
- if (opt == 'm') {
- mode = 0666;
- if (bb_parse_mode(optarg, &mode)) {
- umask(0);
- continue;
- }
- }
- bb_show_usage();
+#if ENABLE_SELINUX
+ if (opt & 2) {
+ selinux_or_die();
+ setfscreatecon_or_die(scontext);
}
+#endif
+
return mode;
}
diff --git a/release/src/router/busybox/coreutils/libcoreutils/xgetoptfile_sort_uniq.c b/release/src/router/busybox/coreutils/libcoreutils/xgetoptfile_sort_uniq.c
deleted file mode 100644
index a63daf97..00000000
--- a/release/src/router/busybox/coreutils/libcoreutils/xgetoptfile_sort_uniq.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* vi: set sw=4 ts=4: */
-/*
- * coreutils utility routine
- *
- * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
- *
- * This program 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.
- *
- * This program 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 this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#include <stdio.h>
-#include <unistd.h>
-#include "libbb.h"
-#include "coreutils.h"
-
-extern FILE *xgetoptfile_sort_uniq(char **argv, const char *mode)
-{
- const char *n;
-
- if ((n = *argv) != NULL) {
- if ((*n != '-') || n[1]) {
- return bb_xfopen(n, mode);
- }
- }
- return (*mode == 'r') ? stdin : stdout;
-}