On Wed, Jun 22, 2016 at 09:02:03PM -0400, [email protected] wrote:
> As brought up on misc@ pax doesn't allow creation of devices or fifos without
> the p flag, however this is only when the archive is not compressed. If you
> compress the archive, you can create them upon decompression/unarchiving.
> Since dpath was added to allow creation of devices in the pledge call for the
> non-compression code path, I am assuming it was meant to be added to the
> compresson code path as well.
>
> Tim.
>
>
> Index: pax.c
> ===================================================================
> RCS file: /cvs/src/bin/pax/pax.c,v
> retrieving revision 1.44
> diff -u -p -r1.44 pax.c
> --- pax.c 16 Dec 2015 01:39:11 -0000 1.44
> +++ pax.c 23 Jun 2016 00:40:55 -0000
> @@ -267,7 +267,7 @@ main(int argc, char **argv)
>
> /* Copy mode, or no gzip -- don't need to fork/exec. */
> if (gzip_program == NULL || act == COPY) {
> - if (pledge("stdio rpath wpath fattr cpath getpw ioctl",
> + if (pledge("stdio rpath wpath dpath fattr cpath getpw
> ioctl",
> NULL) == -1)
> err(1, "pledge");
> }
>
I agree with your diff.
While here, reorder pledge promises to make the order consistent in pax.
There are 3 pledges calls and with same order it makes differencies more
obvious.
OK ?
--
Sebastien Marie
Index: pax.c
===================================================================
RCS file: /cvs/src/bin/pax/pax.c,v
retrieving revision 1.44
diff -u -p -r1.44 pax.c
--- pax.c 16 Dec 2015 01:39:11 -0000 1.44
+++ pax.c 23 Jun 2016 04:38:34 -0000
@@ -261,13 +261,13 @@ main(int argc, char **argv)
* so can't pledge at all then.
*/
if (pmode == 0 || (act != EXTRACT && act != COPY)) {
- if (pledge("stdio rpath wpath cpath dpath fattr getpw ioctl
proc exec",
+ if (pledge("stdio rpath wpath cpath fattr dpath getpw ioctl
proc exec",
NULL) == -1)
err(1, "pledge");
/* Copy mode, or no gzip -- don't need to fork/exec. */
if (gzip_program == NULL || act == COPY) {
- if (pledge("stdio rpath wpath fattr cpath getpw ioctl",
+ if (pledge("stdio rpath wpath cpath fattr dpath getpw
ioctl",
NULL) == -1)
err(1, "pledge");
}