mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-18 14:12:44 +02:00
util/nvmutil: move xpledge/xunveil to nvmutil.h
They don't precisely *pertain* to nvmutil, but they are useful helper functions for calling pledge/unveil in OpenBSD. Ideally, the main file should only contain core logic pertaining to the execution of *nvmutil*. Put xpledge() and xunveil() in nvmutil.h. Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -292,23 +292,3 @@ next_part:
|
|||||||
err(ERR(), "%s", filename);
|
err(ERR(), "%s", filename);
|
||||||
xpledge("stdio", NULL);
|
xpledge("stdio", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
xpledge(const char *promises, const char *execpromises)
|
|
||||||
{
|
|
||||||
(void)promises; (void)execpromises;
|
|
||||||
#ifdef __OpenBSD__
|
|
||||||
if (pledge(promises, execpromises) == -1)
|
|
||||||
err(ERR(), "pledge");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
xunveil(const char *path, const char *permissions)
|
|
||||||
{
|
|
||||||
(void)path; (void)permissions;
|
|
||||||
#ifdef __OpenBSD__
|
|
||||||
if (unveil(path, permissions) == -1)
|
|
||||||
err(ERR(), "unveil");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|||||||
+19
-2
@@ -18,8 +18,6 @@ int validChecksum(int partnum);
|
|||||||
void setWord(int pos16, int partnum, uint16_t val16);
|
void setWord(int pos16, int partnum, uint16_t val16);
|
||||||
void xorswap_buf(int n, int partnum);
|
void xorswap_buf(int n, int partnum);
|
||||||
void writeGbeFile(int *fd, const char *filename, size_t nw);
|
void writeGbeFile(int *fd, const char *filename, size_t nw);
|
||||||
void xpledge(const char *promises, const char *execpromises);
|
|
||||||
void xunveil(const char *path, const char *permissions);
|
|
||||||
|
|
||||||
#define FILENAME argv[1]
|
#define FILENAME argv[1]
|
||||||
#define COMMAND argv[2]
|
#define COMMAND argv[2]
|
||||||
@@ -45,3 +43,22 @@ uint8_t big_endian;
|
|||||||
#define xopen(fd, loc, p) if ((fd = open(loc, p)) == -1) err(ERR(), "%s", loc)
|
#define xopen(fd, loc, p) if ((fd = open(loc, p)) == -1) err(ERR(), "%s", loc)
|
||||||
#define err_if(x) if (x) err(ERR(), NULL)
|
#define err_if(x) if (x) err(ERR(), NULL)
|
||||||
|
|
||||||
|
void
|
||||||
|
xpledge(const char *promises, const char *execpromises)
|
||||||
|
{
|
||||||
|
(void)promises; (void)execpromises;
|
||||||
|
#ifdef __OpenBSD__
|
||||||
|
if (pledge(promises, execpromises) == -1)
|
||||||
|
err(ERR(), "pledge");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
xunveil(const char *path, const char *permissions)
|
||||||
|
{
|
||||||
|
(void)path; (void)permissions;
|
||||||
|
#ifdef __OpenBSD__
|
||||||
|
if (unveil(path, permissions) == -1)
|
||||||
|
err(ERR(), "unveil");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user