aboutsummaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2018-05-25 13:04:09 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2018-05-25 13:04:09 +0200
commit235a783e039986fca3ccefec08ea45804dab196f (patch)
tree0889c3bbdff9611390d42115e8d4891fe60f356b /st.c
parent30ce2cc002585409b36c630512c6ca4db8f88f15 (diff)
downloadst-235a783e039986fca3ccefec08ea45804dab196f.tar.gz
st-235a783e039986fca3ccefec08ea45804dab196f.zip
code-style for pledge(2)
feedback from Klemens, thanks
Diffstat (limited to 'st.c')
-rw-r--r--st.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/st.c b/st.c
index b9750f2..76bb3ea 100644
--- a/st.c
+++ b/st.c
@@ -28,10 +28,6 @@
28 #include <libutil.h> 28 #include <libutil.h>
29#endif 29#endif
30 30
31#ifndef __OpenBSD__
32#define pledge(a,b) 0
33#endif
34
35/* Arbitrary sizes */ 31/* Arbitrary sizes */
36#define UTF_INVALID 0xFFFD 32#define UTF_INVALID 0xFFFD
37#define UTF_SIZ 4 33#define UTF_SIZ 4
@@ -810,13 +806,17 @@ ttynew(char *line, char *cmd, char *out, char **args)
810 die("ioctl TIOCSCTTY failed: %s\n", strerror(errno)); 806 die("ioctl TIOCSCTTY failed: %s\n", strerror(errno));
811 close(s); 807 close(s);
812 close(m); 808 close(m);
809#ifdef __OpenBSD__
813 if (pledge("stdio getpw proc exec", NULL) == -1) 810 if (pledge("stdio getpw proc exec", NULL) == -1)
814 die("pledge\n"); 811 die("pledge\n");
812#endif
815 execsh(cmd, args); 813 execsh(cmd, args);
816 break; 814 break;
817 default: 815 default:
816#ifdef __OpenBSD__
818 if (pledge("stdio rpath tty proc", NULL) == -1) 817 if (pledge("stdio rpath tty proc", NULL) == -1)
819 die("pledge\n"); 818 die("pledge\n");
819#endif
820 close(s); 820 close(s);
821 cmdfd = m; 821 cmdfd = m;
822 signal(SIGCHLD, sigchld); 822 signal(SIGCHLD, sigchld);