diff options
author | Rob Landley <rob@landley.net> | 2008-03-26 00:54:56 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2008-03-26 00:54:56 -0500 |
commit | 50c8c023358645195585f1503bfb97e2fb92c940 (patch) | |
tree | 8ba8b81f17438a05a7dbd2022c6c2c90909a7f82 /toys/cp.c | |
parent | 5ba6663ad463973a39fd65397f9ebda52657eb7c (diff) | |
download | toybox-50c8c023358645195585f1503bfb97e2fb92c940.tar.gz |
Another cp -r fix, another test case...
Diffstat (limited to 'toys/cp.c')
-rw-r--r-- | toys/cp.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -69,8 +69,9 @@ void cp_file(char *src, char *dst, struct stat *srcst) // we created. The closest we can do to closing this is make sure // that what we open _is_ a directory rather than something else. - if (mkdir(dst, srcst->st_mode | 0200) || 0>(fdout=open(dst, 0)) - || fstat(fdout, &st2) || !S_ISDIR(st2.st_mode)) + if ((mkdir(dst, srcst->st_mode | 0200) && errno != EEXIST) + || 0>(fdout=open(dst, 0)) || fstat(fdout, &st2) + || !S_ISDIR(st2.st_mode)) { perror_exit("mkdir '%s'", dst); } |