X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=st.c;h=b9750f28a4eded5b908675bdbb8bb89aac358a5b;hb=30ce2cc002585409b36c630512c6ca4db8f88f15;hp=0628707eae4bc351c483caf7477782d8273203b4;hpb=041912a791e8c2f4d5d2415b16210d29d7e701c5;p=st.git diff --git a/st.c b/st.c index 0628707..b9750f2 100644 --- a/st.c +++ b/st.c @@ -28,6 +28,10 @@ #include #endif +#ifndef __OpenBSD__ +#define pledge(a,b) 0 +#endif + /* Arbitrary sizes */ #define UTF_INVALID 0xFFFD #define UTF_SIZ 4 @@ -806,9 +810,13 @@ ttynew(char *line, char *cmd, char *out, char **args) die("ioctl TIOCSCTTY failed: %s\n", strerror(errno)); close(s); close(m); + if (pledge("stdio getpw proc exec", NULL) == -1) + die("pledge\n"); execsh(cmd, args); break; default: + if (pledge("stdio rpath tty proc", NULL) == -1) + die("pledge\n"); close(s); cmdfd = m; signal(SIGCHLD, sigchld);