make copy_file() a bit easier to understand, and smaller

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
This commit is contained in:
Denis Vlasenko
2007-08-25 21:14:55 +00:00
parent 737d131e5e
commit 30bab71f7b
4 changed files with 68 additions and 71 deletions

View File

@@ -69,7 +69,6 @@ int cp_main(int argc, char **argv)
if (argc == 2) {
s_flags = cp_mv_stat2(*argv, &source_stat,
(flags & FILEUTILS_DEREFERENCE) ? stat : lstat);
/* TODO: does coreutils cp exit? "cp BAD GOOD dir"... */
if (s_flags < 0)
return EXIT_FAILURE;
d_flags = cp_mv_stat(last, &dest_stat);

View File

@@ -31,7 +31,8 @@ int cp_mv_stat2(const char *fn, struct stat *fn_stat, stat_func sf)
return -1;
}
return 0;
} else if (S_ISDIR(fn_stat->st_mode)) {
}
if (S_ISDIR(fn_stat->st_mode)) {
return 3;
}
return 1;