From d4017dbd0a422953bc439db467db9c36d5dd4e33 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Tue, 11 Dec 2018 16:44:15 -0600 Subject: Implement --preserve default = mot behavior (fixes segfault when no argument). --- 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 0b1d0e49..da658319 100644 --- a/toys/posix/cp.c +++ b/toys/posix/cp.c @@ -369,13 +369,12 @@ void cp_main(void) if ((toys.optc>1 || (toys.optflags&FLAG_D)) && !destdir) error_exit("'%s' not directory", destname); - if (toys.optflags & (FLAG_a|FLAG_p)) { + if (toys.optflags & (FLAG_a|FLAG_p)) TT.pflags = _CP_mode|_CP_ownership|_CP_timestamps; - umask(0); - } + // Not using comma_args() (yet?) because interpeting as letters. if (CFG_CP_PRESERVE && (toys.optflags & FLAG_preserve)) { - char *pre = xstrdup(TT.c.preserve), *s; + char *pre = xstrdup(TT.c.preserve ? TT.c.preserve : "mot"), *s; if (comma_scan(pre, "all", 1)) TT.pflags = ~0; for (i=0; i