Fix unveil(2) in patch(1) with explicit patchfile.
authorbluhm <bluhm@openbsd.org>
Wed, 25 Oct 2023 20:05:43 +0000 (20:05 +0000)
committerbluhm <bluhm@openbsd.org>
Wed, 25 Oct 2023 20:05:43 +0000 (20:05 +0000)
commit111e0f2c1ef30bf25ee5a15c0939396c0bbad946
tree3c8bf849a6c39d4e6ced1814c1977a3c5477a274
parent5e9bacf6678801806e3de345b0535922b39eee23
Fix unveil(2) in patch(1) with explicit patchfile.

A backup file should be created in the directory of the original
file, but only the current directory was unveiled.  Then the patched
file was created in /tmp and did not replace the original patchfile
in place.  If a patchfile is passed in argv[0], unveil its directory
instead of current directory.

OK florian@ deraadt@ millert@
usr.bin/patch/patch.c