If ask() can't open /dev/tty for reading, it assumes the default answer
and carries on. Add missing unveil, so that ask() waits for an answer.
This isn't a full fix since it won't allow giving paths outside the tree
rooted at the current directory, but that's expected by the recent change.
Questions are only asked outside of force or batch mode.
fix suggested by op and semarie
ok deraadt florian
-/* $OpenBSD: patch.c,v 1.73 2023/07/15 10:42:54 florian Exp $ */
+/* $OpenBSD: patch.c,v 1.74 2023/07/19 13:26:20 tb Exp $ */
/*
* patch - a program to apply diffs to original files
perror("unveil");
my_exit(2);
}
+ if (!force && !batch)
+ if (unveil(_PATH_TTY, "r") == -1) {
+ perror("unveil");
+ my_exit(2);
+ }
if (unveil(".", "rwc") == -1) {
perror("unveil");
my_exit(2);