mestre fb9a514f5c pledge(2) urlview:
rpath: read config file
tty: the interface it's based on curses so it needs to do operations on tty
proc/exec: this is needed to actually launch the external program after
selecting the link

OK jca@ after his suggestions
2016-03-21 17:41:52 +00:00

29 lines
878 B
Plaintext

$OpenBSD: patch-urlview_c,v 1.4 2016/03/21 17:41:52 mestre Exp $
--- urlview.c.orig Tue Jul 4 11:14:30 2000
+++ urlview.c Mon Mar 21 12:38:33 2016
@@ -46,9 +46,11 @@
#include <rx/rxposix.h>
#endif
+#include "quote.h"
+
#define DEFAULT_REGEXP "(((https?|ftp|gopher)://|(mailto|file|news):)[^' \t<>\"]+|(www|web|w3)\\.[-a-z0-9.]+)[^' \t.,;<>\"\\):]"
#define DEFAULT_COMMAND "url_handler.sh %s"
-#define SYSTEM_INITFILE "/etc/urlview.conf"
+#define SYSTEM_INITFILE "${SYSCONFDIR}/urlview.conf"
#define OFFSET 2
#define PAGELEN (LINES - 1 - OFFSET)
@@ -187,6 +189,11 @@ int main (int argc, char **argv)
pw = getpwuid (getuid ());
snprintf (buf, sizeof (buf), "%s/.urlview", pw->pw_dir);
+
+ if (pledge("stdio rpath tty proc exec", NULL) == -1) {
+ perror("pledge");
+ exit(1);
+ }
/*** Check for users rc-file ***/
if (stat (buf,&stat_buf) == -1)