23 |
#include "libbb.h" |
#include "libbb.h" |
24 |
#include "coreutils.h" |
#include "coreutils.h" |
25 |
|
|
26 |
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) |
27 |
{ |
{ |
28 |
if (sf(fn, fn_stat) < 0) { |
if (sf(fn, fn_stat) < 0) { |
29 |
if (errno != ENOENT) { |
if (errno != ENOENT) { |
30 |
|
#if ENABLE_FEATURE_VERBOSE_CP_MESSAGE |
31 |
|
if (errno == ENOTDIR) { |
32 |
|
bb_error_msg("cannot stat '%s': Path has non-directory component", fn); |
33 |
|
return -1; |
34 |
|
} |
35 |
|
#endif |
36 |
bb_perror_msg("cannot stat '%s'", fn); |
bb_perror_msg("cannot stat '%s'", fn); |
37 |
return -1; |
return -1; |
38 |
} |
} |
39 |
return 0; |
return 0; |
40 |
} else if (S_ISDIR(fn_stat->st_mode)) { |
} |
41 |
|
if (S_ISDIR(fn_stat->st_mode)) { |
42 |
return 3; |
return 3; |
43 |
} |
} |
44 |
return 1; |
return 1; |
45 |
} |
} |
46 |
|
|
47 |
int cp_mv_stat(const char *fn, struct stat *fn_stat) |
int FAST_FUNC cp_mv_stat(const char *fn, struct stat *fn_stat) |
48 |
{ |
{ |
49 |
return cp_mv_stat2(fn, fn_stat, stat); |
return cp_mv_stat2(fn, fn_stat, stat); |
50 |
} |
} |