install: only create parent dirs to dest given -D
Given the following commands: touch 1.txt; install -D 1.txt d/2.txt find d The result without this fix: d d/2.txt d/2.txt/1.txt The result with this patch applied: d d/2.txt
This commit is contained in:
parent
4f701bcd8a
commit
b97839751b
@ -241,11 +241,12 @@ main(int argc, char *argv[])
|
|||||||
if (stat(argv[argc - 1], &st) < 0) {
|
if (stat(argv[argc - 1], &st) < 0) {
|
||||||
if (errno != ENOENT)
|
if (errno != ENOENT)
|
||||||
eprintf("stat %s:", argv[argc - 1]);
|
eprintf("stat %s:", argv[argc - 1]);
|
||||||
if (tflag || argc > 2) {
|
if (tflag || Dflag || argc > 2) {
|
||||||
p = strrchr(argv[argc - 1], '/');
|
if ((p = strrchr(argv[argc - 1], '/')) != NULL) {
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
make_dirs(argv[argc - 1], 1);
|
make_dirs(argv[argc - 1], 1);
|
||||||
*p = '/';
|
*p = '/';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
make_dirs(argv[argc - 1], 1);
|
make_dirs(argv[argc - 1], 1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user