Userland: /bin/cp needs to handle open(dst) failing with EISDIR.

This commit is contained in:
Andreas Kling 2019-03-06 20:28:00 +01:00
parent e6f389a544
commit 3079ef01ce
Notes: sideshowbarker 2024-07-19 15:09:34 +09:00

View file

@ -36,18 +36,10 @@ int main(int argc, char** argv)
int dst_fd = open(dst_path.characters(), O_WRONLY | O_CREAT);
if (dst_fd < 0) {
perror("open dst");
return 1;
}
struct stat dst_stat;
rc = fstat(dst_fd, &dst_stat);
if (rc < 0) {
perror("stat dst");
return 1;
}
if (S_ISDIR(dst_stat.st_mode)) {
if (errno != EISDIR) {
perror("open dst");
return 1;
}
StringBuilder builder;
builder.append(dst_path);
builder.append('/');