Hi,
This adds pledge(2) to archivers/lha with the following promises per each action
list -> rpath, can be dropped once fd is opened
add/extract/delete -> rpath wpath cpath fattr
Tested with my old Amiga games' archives on amd64.
Comments? OK?
Index: Makefile
===================================================================
RCS file: /cvs/ports/archivers/lha/Makefile,v
retrieving revision 1.39
diff -u -p -u -r1.39 Makefile
--- Makefile 14 Jul 2019 00:39:34 -0000 1.39
+++ Makefile 2 Nov 2021 12:52:41 -0000
@@ -4,7 +4,7 @@ COMMENT= archive files using LZW compres
DISTNAME= lha-1.14i-ac20050924p1
PKGNAME= lha-1.14i.ac20050924.1
-REVISION= 3
+REVISION= 4
CATEGORIES= archivers
HOMEPAGE= https://lha.osdn.jp/
Index: patches/patch-src_lharc_c
===================================================================
RCS file: patches/patch-src_lharc_c
diff -N patches/patch-src_lharc_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_lharc_c 2 Nov 2021 12:52:41 -0000
@@ -0,0 +1,25 @@
+$OpenBSD$
+
+Index: src/lharc.c
+--- src/lharc.c.orig
++++ src/lharc.c
+@@ -542,6 +542,9 @@ main(argc, argv)
+
+ int i;
+
++ if (pledge("stdio rpath wpath cpath fattr", NULL) == -1)
++ fatal_error("pledge");
++
+ init_variable(); /* Added N.Watazaki */
+
+ if (parse_option(argc, argv) == -1) {
+@@ -616,6 +619,9 @@ main(argc, argv)
+ cmd_add();
+ break;
+ case CMD_LIST:
++ if (pledge("stdio rpath", NULL) == -1)
++ fatal_error("pledge");
++
+ cmd_list();
+ break;
+ case CMD_DELETE:
Index: patches/patch-src_lhlist_c
===================================================================
RCS file: patches/patch-src_lhlist_c
diff -N patches/patch-src_lhlist_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_lhlist_c 2 Nov 2021 12:52:41 -0000
@@ -0,0 +1,16 @@
+$OpenBSD$
+
+Index: src/lhlist.c
+--- src/lhlist.c.orig
++++ src/lhlist.c
+@@ -321,6 +321,10 @@ cmd_list()
+ error("Cannot open archive \"%s\"", archive_name);
+ exit(1);
+ }
++
++ if (pledge("stdio", NULL) == -1)
++ fatal_error("pledge");
++
+ if (archive_is_msdos_sfx1(archive_name))
+ seek_lha_header(afp);
+
No comments:
Post a Comment