summaryrefslogtreecommitdiff
path: root/libbb/copy_file.c
AgeCommit message (Collapse)Author
2009-07-05cp: make "non-POSIX" cp a bit more consistentDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-05cp: by popular demand, make it POSIX compliant (but less safe)Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2008-06-27*: introduce and use FAST_FUNC: regparm on i386, otherwise no-onDenis Vlasenko
text data bss dec hex filename 808035 611 6868 815514 c719a busybox_old 804472 611 6868 811951 c63af busybox_unstripped
2008-03-28copy_file: handle "cp /dev/foo file" (almost) compatibly to coreutils.Denis Vlasenko
(almost because we do not copy mode, which is probably wasn't intended). +61 bytes.
2008-02-13cp: add ENABLE_FEATURE_VERBOSE_CP_MESSAGE. Closes bug 1470Denis Vlasenko
2007-09-11cp: make it a bit closer to POSIX, but still refuse to open andDenis Vlasenko
write to dest which is a symlink.
2007-09-11cp: make "cp file /dev/node" special case; explained in commentsDenis Vlasenko
function old new delta copy_file 1487 1538 +51 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 51/0) Total: 51 bytes text data bss dec hex filename 772502 1051 10724 784277 bf795 busybox_old 772554 1051 10724 784329 bf7c9 busybox_unstripped
2007-08-27cp: fix recursion check to not waste bytes remembering names of dirsDenis Vlasenko
2007-08-27cp: detect and prevent infinite recursionDenis Vlasenko
2007-08-25make copy_file() a bit easier to understand, and smallerDenis Vlasenko
function old new delta copy_file 1565 1447 -118 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-118) Total: -118 bytes text data bss dec hex filename 770938 1063 10788 782789 bf1c5 busybox_old 770814 1063 10788 782665 bf149 busybox_unstripped
2007-08-24cp: make POSIX-me-harder mode complain with a bit less insane messageDenis Vlasenko
2007-06-20do not do utime() on links, it acts on link targets, and we don't want that.Denis Vlasenko
rename link_name to link_target, less confusing this way.
2007-04-12style fixes. No code changesDenis Vlasenko
2007-04-11bb_full_fd_action: remove potential xmalloc from NOFORK pathDenis Vlasenko
cat: stop using stdio.h opens libbb: introduce & use open[3]_or_warn function old new delta open3_or_warn - 54 +54 bb_cat 115 144 +29 open_or_warn - 25 +25 unlzma 2404 2412 +8 chattr_main 334 339 +5 xstrtoul_range_sfx 251 255 +4 telnet_main 1514 1510 -4 static.opt 4 - -4 qgravechar 122 118 -4 fuser_add_pid 61 54 -7 fuser_add_inode 154 147 -7 writeFileToTarball 1542 1534 -8 refresh 1156 1148 -8 do_show 856 846 -10 read_leases 212 200 -12 setup_redirects 236 222 -14 iproute_list_or_flush 1582 1568 -14 read_config 427 411 -16 write_leases 284 264 -20 hash_file 338 318 -20 copy_file 1760 1740 -20 do_iproute 2610 2588 -22 bb_full_fd_action 320 269 -51 open_to_or_warn 103 49 -54 fuser_main 1660 1596 -64 .rodata 131160 131096 -64 ------------------------------------------------------------------------------ (add/remove: 2/1 grow/shrink: 4/19 up/down: 125/-423) Total: -298 bytes
2007-03-20fix accumulated whitespace and indentation damageDenis Vlasenko
2007-03-15copy_file: comment out one condition which is always false.Denis Vlasenko
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-14stop using big static buffer for inode hashDenis Vlasenko
2007-03-12introduce and use setfscreatecon_or_dieDenis Vlasenko
(patch by Yuichi Nakamura <ynakam@hitachisoft.jp>) runcon: *yet another* fix for vda's brainfart :(
2007-03-10selinux support by Yuichi Nakamura <ynakam@hitachisoft.jp> (HitachiSoft)Denis Vlasenko
2007-02-11syslogd: fix "readpath bug" by using readlink insteadDenis Vlasenko
libbb: rename xgetcwd and xreadlink
2007-01-11Trailing whitespace removal over entire treeDenis Vlasenko
2006-10-21cp: add support for -s, -l. Fix free(nonmalloc) bug.Denis Vlasenko
Add doc on POSIX's rules on -i and -f (insane!). ln: make "ln dangling_symlink new_link" work.
2006-10-03bb_applet_name -> applet_nameDenis Vlasenko
2006-08-03Remove bb_ prefixes from xfuncs.c (and a few other places), consolidateRob Landley
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-06-24The logic to make cp -d or -P treat things like regular files should onlyRob Landley
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-13Random cleanup of platform.h.Rob Landley
2006-04-12- add and use bb_opendir(), bb_xopendir().Bernhard Reutner-Fischer
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-03- move buffer allocation schemes to libbb.hBernhard Reutner-Fischer
- include the correct headers: applets need busybox.h while lib* need libbb.h
2006-03-14Attempt to make a warning go away without increasing size.Rob Landley
2006-01-25just whitespaceTim Riker
2005-11-01Fix cp /dev/null filename, and a few in-passing cleanups.Rob Landley
2005-07-19applying fix for:Paul Fox
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-19applying fix from:Paul Fox
0000067: cp -p produces misleading error message
2005-04-14fake out support for POSIX -H and -L options since busybox cp dereferences ↵Mike Frysinger
everything by default
2004-04-19Dont try and preserve hard links to directories.Glenn L McGrath
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-02-22For the time being, revert the changes for detecting copyingEric Andersen
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-19Chris Larson (kergoth) writes:Eric Andersen
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-19Chris Larson (kergoth) writes:Eric Andersen
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-01-11Patch from Matt Kraai to fix debian bug #227081Glenn L McGrath
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
2003-12-20Use low level file descriptors to match bb_copyfd_eofGlenn L McGrath
2003-11-21As we no longer use function pointers for read in common archiving codeGlenn L McGrath
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-05-26Vodz, last_patch_86Glenn L McGrath
2003-03-19Major coreutils update.Manuel Novoa III
2002-12-13Merge copyfd and copy_file_chunkGlenn L McGrath
2002-09-17last_patch56 from vodz to simplify copy_file logicEric Andersen
2002-09-16Let people force overwrite linksEric Andersen
-Erik
2002-09-16Properly honor FILEUTILS_INTERACTIVE and FILEUTILS_FORCE forEric Andersen
file all file types (not just regular files and dirs). Unlink destination files when needed. -Erik
2002-06-11* libbb/copy_file.c (copy_file): Check st_dev instead of st_rdev.Matt Kraai
2001-12-17Make cp and mv optionally preserve hard links.Matt Kraai
2001-12-11Open the source before creating the destination.Matt Kraai