1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:37:35 +00:00

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

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('/');