summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2015-11-14 17:13:22 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2015-11-14 17:13:22 +0000
commit7c37e867c7b7103ef82fd4031c50955cc29ea122 (patch)
treee278344519928cc7ff28c62237ad3c959cb70fb2
parent8c6eebce51f96b453a8327774b15fd41dcca1326 (diff)
pledge xconsole(1).
-rw-r--r--app/xconsole/xconsole.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/app/xconsole/xconsole.c b/app/xconsole/xconsole.c
index 6aa84c058..b76771fa9 100644
--- a/app/xconsole/xconsole.c
+++ b/app/xconsole/xconsole.c
@@ -78,6 +78,7 @@ extern char *_XawTextGetSTRING(TextWidget ctx, XawTextPosition left,
#endif
#ifdef USE_PRIVSEP
+#include <err.h>
#include <pwd.h>
#include "xconsole.h"
#endif
@@ -647,7 +648,11 @@ main(int argc, char *argv[])
fprintf(stderr, "priv_init failed\n");
exit(2);
}
- }
+ } else
+ if (priv_init(-1, -1) < 0) {
+ fprintf(stderr, "priv_init failed\n");
+ exit(2);
+ }
#endif
if (app_resources.daemon)
@@ -688,6 +693,12 @@ main(int argc, char *argv[])
#ifdef USE_OSM
ioerror = XSetIOErrorHandler(IOError);
#endif
+
+#ifdef USE_PRIVSEP
+ if (pledge("stdio rpath sendfd recvfd", NULL) == -1)
+ err(1, "pledge");
+#endif
+
XtMainLoop ();
return 0;
}