mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-07 02:10:27 +00:00
fix basename error with cp.com
when the destination is a folder, cp.com should take the basename of the source file and add it to the destination. cp.c was instead using the basename function itself as a string (?), and not calling basename.
This commit is contained in:
parent
9bfa6ec06e
commit
92e8c17478
1 changed files with 1 additions and 1 deletions
|
@ -73,7 +73,7 @@ void GetOpts(int argc, char *argv[]) {
|
|||
|
||||
int cp(const char *src, const char *dst) {
|
||||
if (endswith(dst, "/") || isdirectory(dst)) {
|
||||
dst = _gc(xasprintf("%s/%s", dst, basename));
|
||||
dst = _gc(xasprintf("%s/%s", dst, basename(src)));
|
||||
}
|
||||
if (!force && access(dst, W_OK) == -1 && errno != ENOENT) goto OnFail;
|
||||
if (copyfile(src, dst, flags) == -1) goto OnFail;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue