Commit Graph

52 Commits

Author SHA1 Message Date
Denis Vlasenko
c86e052b81 fix accumulated whitespace and indentation damage 2007-03-20 11:30:28 +00:00
Denis Vlasenko
54d14ca1a2 copy_file: comment out one condition which is always false.
Add comment explaining POSIX rules for cp - and why
these rules are dangerous. Provide conditionally compiled code
for both POSIX and safe behaviors, select safe for now.
Code shrunk by ~80 bytes.
2007-03-15 13:33:37 +00:00
Denis Vlasenko
6ef06eeed4 stop using big static buffer for inode hash 2007-03-14 22:06:01 +00:00
Denis Vlasenko
39c651e909 introduce and use setfscreatecon_or_die
(patch by Yuichi Nakamura <ynakam@hitachisoft.jp>)
runcon: *yet another* fix for vda's brainfart :(
2007-03-12 18:22:55 +00:00
Denis Vlasenko
49622d7846 selinux support by Yuichi Nakamura <ynakam@hitachisoft.jp> (HitachiSoft) 2007-03-10 16:58:49 +00:00
Denis Vlasenko
6ca0444420 syslogd: fix "readpath bug" by using readlink instead
libbb: rename xgetcwd and xreadlink
2007-02-11 16:19:28 +00:00
Denis Vlasenko
f7996f3b70 Trailing whitespace removal over entire tree 2007-01-11 17:20:00 +00:00
Denis Vlasenko
f24e1f40e0 cp: add support for -s, -l. Fix free(nonmalloc) bug.
Add doc on POSIX's rules on -i and -f (insane!).
ln: make "ln dangling_symlink new_link" work.
2006-10-21 23:40:20 +00:00
Denis Vlasenko
8f8f268cfd bb_applet_name -> applet_name 2006-10-03 21:00:43 +00:00
Rob Landley
d921b2ecc0 Remove bb_ prefixes from xfuncs.c (and a few other places), consolidate
things like xasprintf() into xfuncs.c, remove xprint_file_by_name() (it only
had one user), clean up lots of #includes...  General cleanup pass.  What I've
been doing for the last couple days.

And it conflicts!  I've removed httpd.c from this checkin due to somebody else
touching that file.  It builds for me.  I have to catch a bus.  (Now you know
why I'm looking forward to Mercurial.)
2006-08-03 15:41:12 +00:00
Rob Landley
c983274565 The logic to make cp -d or -P treat things like regular files should only
trigger for symlinks, not for device nodes.  This should fix "cp -a /dev ."
to work as expected (when run by root, anyway).

While I was there, cleanup headers and make an #ifdef go away...
2006-06-24 21:27:36 +00:00
Rob Landley
18958e9309 Random cleanup of platform.h. 2006-06-13 18:28:33 +00:00
Bernhard Reutner-Fischer
cb44816ba3 - add and use bb_opendir(), bb_xopendir().
text    data     bss     dec     hex filename
 889445    9392 1035784 1934621  1d851d busybox.gcc-4.2.orig
 889297    9392 1035784 1934473  1d8489 busybox.gcc-4.2
 889009    9820 1037860 1936689  1d8d31 busybox.gcc-4.1.orig
 888817    9820 1037860 1936497  1d8c71 busybox.gcc-4.1
2006-04-12 07:35:12 +00:00
Bernhard Reutner-Fischer
421d9e5941 - move buffer allocation schemes to libbb.h
- include the correct headers: applets need busybox.h while lib* need libbb.h
2006-04-03 16:39:31 +00:00
Rob Landley
386f85eadf Attempt to make a warning go away without increasing size. 2006-03-14 21:13:48 +00:00
Tim Riker
c1ef7bdd8d just whitespace 2006-01-25 00:08:53 +00:00
Rob Landley
2f30932eca Fix cp /dev/null filename, and a few in-passing cleanups. 2005-11-01 21:55:14 +00:00
Paul Fox
c337d29550 applying fix for:
0000117: Remove linefeed after overwrite prompt using cp -i
	  User input not on the same line as the prompt when about to
	  overwrite a file.
2005-07-19 21:31:05 +00:00
Paul Fox
0a92bbf349 applying fix from:
0000067: cp -p produces misleading error message
2005-07-19 20:47:33 +00:00
Mike Frysinger
2ed05ab146 fake out support for POSIX -H and -L options since busybox cp dereferences everything by default 2005-04-14 02:52:50 +00:00
Glenn L McGrath
1219879422 Dont try and preserve hard links to directories.
The linux kernel doesnt allow hard links to directories, SUS says its
implementation specific.
cramfs gives empty directories and 0 length files the same node it
makies it difficult to distinguish from hard links.
2004-04-19 12:28:02 +00:00
Eric Andersen
817565a0ff For the time being, revert the changes for detecting copying
a directory into itself.  It is harder to do this correctly
than it appears.  Not trying at all seems a better compromise
for the time being, untill we can implement this correctly.
2004-02-22 11:46:49 +00:00
Eric Andersen
e7d244cc96 Chris Larson (kergoth) writes:
As Manuel points out, this is a flawed fix, and doesnt fix the
following:

mkdir -p cpa cpb cpc
cp -a cpa cpa/cpb/cpc

Attached what appears to be a more sane fix.  Apply on top of previous.
Please confirm sanity.
2004-02-19 01:52:29 +00:00
Eric Andersen
e0cbe48637 Chris Larson (kergoth) writes:
I was adding -s/--symbolic-link support to busybox cp when I noticed a
bug with -r/-a.  Test case:

mkdir -p test/out
cd test
busybox cp -a * out/

Will never return until we run out of open files or similar.
Coreutils cp on the other hand will error with "cannot copy a directory,
`out', into itself, `out'".  Patch attached.
2004-02-19 00:44:08 +00:00
Glenn L McGrath
447bc2d17f Patch from Matt Kraai to fix debian bug #227081
cp does not truncate existing destinations.  That is, after
running

 echo foo > foo
 echo fubar > fubar
 cp foo fubar

the contents of fubar are

 foo
 r

instead of

 foo
2004-01-11 05:20:59 +00:00
Glenn L McGrath
f62ea20aff Use low level file descriptors to match bb_copyfd_eof 2003-12-20 04:38:01 +00:00
Glenn L McGrath
7ffe133864 As we no longer use function pointers for read in common archiving code
archive_xread can be replaced with bb_full_read, and archive_copy_file
with bb_copyfd*
bb_copyfd is split into two functions bb_copyfd_size and bb_copyfd_eof,
they share a common backend.
2003-11-21 22:24:57 +00:00
Glenn L McGrath
393183dccc Vodz, last_patch_86 2003-05-26 14:07:50 +00:00
Manuel Novoa III
cad5364599 Major coreutils update. 2003-03-19 09:13:01 +00:00
Glenn L McGrath
25fe94fd32 Merge copyfd and copy_file_chunk 2002-12-13 08:20:44 +00:00
Eric Andersen
a9a220b92a last_patch56 from vodz to simplify copy_file logic 2002-09-17 08:42:21 +00:00
Eric Andersen
02b8dfc524 Let people force overwrite links
-Erik
2002-09-16 10:23:38 +00:00
Eric Andersen
403a73a351 Properly honor FILEUTILS_INTERACTIVE and FILEUTILS_FORCE for
file all file types (not just regular files and dirs).  Unlink
destination files when needed.
 -Erik
2002-09-16 09:23:22 +00:00
Matt Kraai
9ef2ea27d4 * libbb/copy_file.c (copy_file): Check st_dev instead of st_rdev. 2002-06-11 13:25:26 +00:00
Matt Kraai
ace02dc9cd Make cp and mv optionally preserve hard links. 2001-12-17 15:26:36 +00:00
Matt Kraai
14b7c5d12b Open the source before creating the destination. 2001-12-11 16:43:48 +00:00
Eric Andersen
bdfd0d78bc Major rework of the directory structure and the entire build system.
-Erik
2001-10-24 05:00:29 +00:00
Matt Kraai
4c557bf576 Invert FILEUTILS_PRESERVE_SYMLINKS into FILEUTILS_DEREFERENCE. 2001-10-05 01:35:10 +00:00
Eric Andersen
75220b55ff dfp might be used uninitialized. NULL it. 2001-08-21 23:36:32 +00:00
Manuel Novoa III
a2949aa217 Add some missing includes to kill warnings when building with the default
Config.h and using gcc's -fno-builtin.  There are probably other files
with the similar problems.
Also, if building against uClibc, don't include asm/unistd.h in syscalls.c
and module_syscalls.c.
2001-06-29 18:59:32 +00:00
Matt Kraai
bf0a010cf7 Copy files until EOF, not the reported file size, to deal with bad sizes in
the proc filesystem.
2001-06-11 13:58:02 +00:00
Mark Whitley
8a633268ef Made new xreadlink function for libbb and changed applets to use it instead of
readlink(2).
2001-04-30 18:17:00 +00:00
Matt Kraai
218aa370b4 Fix user permissions of copied directories. 2001-04-30 17:32:43 +00:00
Matt Kraai
43ca13714b Simplify permission handling for FIFOs. 2001-04-30 16:43:21 +00:00
Matt Kraai
24abecc349 Fix exit status when there is an error copying a file. 2001-04-30 16:37:04 +00:00
Matt Kraai
72ab975a6b Terminate source correctly when copying symlink. Report and patch by
Brian Webb <webbb@desertscenes.net>.
2001-04-27 15:40:27 +00:00
Matt Kraai
01441036e9 Use generic flag names. 2001-04-24 01:30:02 +00:00
Matt Kraai
9ff9325e60 Move applet_name declaration from busybox.h to libbb.h. 2001-04-24 01:12:33 +00:00
Matt Kraai
91b2855ba8 Rewrite cp and mv to be SUSv2 compliant. 2001-04-23 18:53:07 +00:00
Glenn L McGrath
6ebd633829 Set permissions of created file 2001-04-20 05:16:38 +00:00