Another cp -r fix, another test case...
This commit is contained in:
parent
5ba6663ad4
commit
50c8c02335
@ -78,10 +78,12 @@ touch one/{six,seven,eight}
|
||||
testing "cp -r /abspath dest" \
|
||||
"cp -r \"$(readlink -f one)\" dir && diff -r one dir && echo yes" \
|
||||
"yes\n" "" ""
|
||||
testing "cp -r dir again" "cp -r one/. dir && diff -r one dir && echo yes" \
|
||||
"yes\n" "" ""
|
||||
mkdir dir2
|
||||
testing "cp -r dir1/* dir2" \
|
||||
"cp -r one/* dir2 && diff -r one dir2 && echo yes" "yes\n" "" ""
|
||||
rm -rf one dir2
|
||||
rm -rf one dir dir2
|
||||
|
||||
# cp -r ../source destdir
|
||||
# cp -r one/two/three missing
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user