Skip to content

Commit 8df42bc

Browse files
committed
cp: glibc compat fixes
1 parent cd41d49 commit 8df42bc

2 files changed

Lines changed: 20 additions & 2 deletions

File tree

‎patches/src.freebsd.patch‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2170,6 +2170,24 @@
21702170
mode_t mask, mode;
21712171
bool beneath = Rflag && type != FILE_TO_FILE;
21722172

2173+
@@ -318,7 +332,7 @@
2174+
to.end = to.path + strlcpy(to.path, to.base, sizeof(to.path));
2175+
to.base[0] = '\0';
2176+
} else if (type == FILE_TO_DIR) {
2177+
- to.dir = open(to.base, O_DIRECTORY | O_SEARCH);
2178+
+ to.dir = open(to.base, O_DIRECTORY | O_PATH);
2179+
if (to.dir < 0)
2180+
err(1, "%s", to.base);
2181+
/*
2182+
@@ -401,7 +415,7 @@
2183+
umask(~mask);
2184+
continue;
2185+
}
2186+
- to.dir = open(to.base, O_DIRECTORY | O_SEARCH);
2187+
+ to.dir = open(to.base, O_DIRECTORY | O_PATH);
2188+
if (to.dir < 0) {
2189+
warn("%s", to.base);
2190+
(void)rmdir(to.base);
21732191
@@ -509,6 +523,7 @@
21742192
if (preserve_dir_acls(curr->fts_accpath,
21752193
to.path) != 0)

‎src.freebsd/coreutils/cp/cp.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ copy(char *argv[], enum op type, int fts_options, struct stat *root_stat)
332332
to.end = to.path + strlcpy(to.path, to.base, sizeof(to.path));
333333
to.base[0] = '\0';
334334
} else if (type == FILE_TO_DIR) {
335-
to.dir = open(to.base, O_DIRECTORY | O_SEARCH);
335+
to.dir = open(to.base, O_DIRECTORY | O_PATH);
336336
if (to.dir < 0)
337337
err(1, "%s", to.base);
338338
/*
@@ -415,7 +415,7 @@ copy(char *argv[], enum op type, int fts_options, struct stat *root_stat)
415415
umask(~mask);
416416
continue;
417417
}
418-
to.dir = open(to.base, O_DIRECTORY | O_SEARCH);
418+
to.dir = open(to.base, O_DIRECTORY | O_PATH);
419419
if (to.dir < 0) {
420420
warn("%s", to.base);
421421
(void)rmdir(to.base);

0 commit comments

Comments
 (0)