mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
Userland: /bin/cp needs to handle open(dst) failing with EISDIR.
This commit is contained in:
parent
e6f389a544
commit
3079ef01ce
Notes:
sideshowbarker
2024-07-19 15:09:34 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/3079ef01ce4
1 changed files with 4 additions and 12 deletions
|
@ -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('/');
|
||||
|
|
Loading…
Reference in a new issue