.
This commit is contained in:
parent
9a507a6bd0
commit
ecb6f39d33
@ -88,7 +88,7 @@ int cptree(const char *src, const char *dst) {
|
||||
if (get_stat(src, &stat_path))
|
||||
return 1;
|
||||
|
||||
if (!S_ISDIR(stat_path.st_mode)) {
|
||||
if (S_ISDIR(stat_path.st_mode) == 0) {
|
||||
if (copy(src, dst)) {
|
||||
fprintf(stderr, "cp: %s: copy() failed (%s)\n", src, strerror(errno));
|
||||
return 1;
|
||||
@ -147,6 +147,11 @@ int main(const int argc, char **argv) {
|
||||
ret = cptree(argv[i], argv[argc - 1]);
|
||||
|
||||
else {
|
||||
if (mkdir(argv[argc - 1], 0777) < 0) {
|
||||
fprintf(stderr, "cp: %s\n", strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (; i < argc - 1; i++) {
|
||||
char *new_path = make_path(argv[argc - 1], basename(argv[i]));
|
||||
if (new_path == NULL)
|
||||
|
@ -1,4 +1,7 @@
|
||||
#ifdef __linux__
|
||||
#include <sys/sysmacros.h>
|
||||
#endif
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
Loading…
Reference in New Issue
Block a user