summaryrefslogtreecommitdiff
path: root/util/libreboot-utils/mkhtemp.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/libreboot-utils/mkhtemp.c')
-rw-r--r--util/libreboot-utils/mkhtemp.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/util/libreboot-utils/mkhtemp.c b/util/libreboot-utils/mkhtemp.c
index 86aab536..9ff70328 100644
--- a/util/libreboot-utils/mkhtemp.c
+++ b/util/libreboot-utils/mkhtemp.c
@@ -41,6 +41,9 @@ exit_cleanup(void);
int
main(int argc, char *argv[])
{
+#ifndef __linux__
+#error This code is currently buggy on BSD systems. Only use on Linux.
+#endif
size_t len;
size_t tlen;
size_t xc = 0;
@@ -59,8 +62,11 @@ main(int argc, char *argv[])
(void) errhook(exit_cleanup);
(void) lbsetprogname(argv[0]);
+#ifdef __OpenBSD__
/* https://man.openbsd.org/pledge.2 */
- xpledgex("stdio flock rpath wpath cpath", NULL);
+ if (pledge("stdio flock rpath wpath cpath fattr", NULL) == -1)
+ exitf("pledge");
+#endif
while ((c =
getopt(argc, argv, "qdp:")) != -1) {
@@ -117,7 +123,10 @@ main(int argc, char *argv[])
tmpdir, template) < 0)
exitf("%s", s);
- xpledgex("stdio", NULL);
+#ifdef __OpenBSD__
+ if (pledge("stdio", NULL) == -1)
+ exitf("pledge");
+#endif
if (s == NULL)
exitf("bad string initialisation");