From 3cde24138ac06e384965db2944e858d2110ecacb Mon Sep 17 00:00:00 2001 From: Ethan Sommer Date: Wed, 24 Mar 2021 14:25:15 -0400 Subject: Fix install -t --- toys/posix/cp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'toys/posix') diff --git a/toys/posix/cp.c b/toys/posix/cp.c index d98c2ae7..a27c200a 100644 --- a/toys/posix/cp.c +++ b/toys/posix/cp.c @@ -520,11 +520,11 @@ void install_main(void) return; } - if (FLAG(D) && !FLAG(t)) { - TT.destname = toys.optargs[toys.optc-1]; - if (mkpathat(AT_FDCWD, TT.destname, 0, MKPATHAT_MAKE)) - perror_exit("-D '%s'", TT.destname); - if (toys.optc == 1) return; + if (FLAG(D)) { + char *destname = FLAG(t) ? TT.i.t : (TT.destname = toys.optargs[toys.optc-1]); + if (mkpathat(AT_FDCWD, destname, 0777, MKPATHAT_MAKE | (FLAG(t) ? MKPATHAT_MKLAST : 0))) + perror_exit("-D '%s'", destname); + if (toys.optc == !FLAG(t)) return; } // Translate flags from install to cp -- cgit v1.2.3