summaryrefslogtreecommitdiff
path: root/util/libreboot-utils/lib/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/libreboot-utils/lib/string.c')
-rw-r--r--util/libreboot-utils/lib/string.c50
1 files changed, 21 insertions, 29 deletions
diff --git a/util/libreboot-utils/lib/string.c b/util/libreboot-utils/lib/string.c
index 5e0b4c33..7388cf35 100644
--- a/util/libreboot-utils/lib/string.c
+++ b/util/libreboot-utils/lib/string.c
@@ -270,6 +270,27 @@ out:
return *rval;
}
+int
+dup_pair(char **dir, const char *d,
+ char **base, const char *b)
+{
+ char *dtmp = NULL;
+ char *btmp = NULL;
+
+ if (d && sdup(d, PATH_MAX, &dtmp) == NULL)
+ return -1;
+
+ if (b && sdup(b, PATH_MAX, &btmp) == NULL) {
+ free(dtmp);
+ return -1;
+ }
+
+ *dir = dtmp;
+ *base = btmp;
+
+ return 0;
+}
+
/* strict word-based strdup */
char *
sdup(const char *s,
@@ -620,32 +641,3 @@ lbsetprogname(char *argv0)
return progname;
}
-
-/* https://man.openbsd.org/pledge.2
- https://man.openbsd.org/unveil.2 */
-int
-xpledgex(const char *promises, const char *execpromises)
-{
- int saved_errno = errno;
- (void) promises, (void) execpromises, (void) saved_errno;
- errno = 0;
-#ifdef __OpenBSD__
- if (pledge(promises, execpromises) == -1)
- exitf("pledge");
-#endif
- reset_caller_errno(0);
- return 0;
-}
-int
-xunveilx(const char *path, const char *permissions)
-{
- int saved_errno = errno;
- (void) path, (void) permissions, (void) saved_errno;
- errno = 0;
-#ifdef __OpenBSD__
- if (pledge(promises, execpromises) == -1)
- exitf("pledge");
-#endif
- reset_caller_errno(0);
- return 0;
-}