xinstall: Do not allow -l and -s together

Cannot strip the target if creating a link.

Reviewed by:	des
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57398
This commit is contained in:
Ed Maste
2026-06-02 21:27:54 -04:00
parent 4908bea5b7
commit 521afce6a8
2 changed files with 9 additions and 0 deletions
+3
View File
@@ -27,8 +27,11 @@
atf_test_case incompatible_opts
incompatible_opts_body() {
printf 'test\n123\r456\r\n789\0z' >testf
atf_check -s not-exit:0 -e match:"specified together" \
install -s -d dir1
atf_check -s not-exit:0 -e match:"specified together" \
install -s -l s testf copyf
}
atf_test_case copy_to_empty
+6
View File
@@ -293,6 +293,12 @@ main(int argc, char *argv[])
usage();
}
/* Cannot strip if creating a link. */
if (dostrip && dolink) {
warnx("-l and -s may not be specified together");
usage();
}
/*
* Default permissions based on whether we're a directory or not, since
* an +X may mean that we need to set the execute bit.