mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-23 16:42:17 +02:00
util/*: Properly detect OpenBSD for pledge() call
The utils that are pledged checked HAVE_PLEDGE which was bogus. OpenBSD defines __OpenBSD__, which you can check for in ifdef. This change makes nvmutil and spkmodem-recv *actually* use pledge, when the utils are compiled on OpenBSD. Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -83,7 +83,7 @@ main(int argc, char *argv[])
|
|||||||
void (*cmd)(void) = NULL;
|
void (*cmd)(void) = NULL;
|
||||||
const char *strMac = NULL, *strRMac = "??:??:??:??:??:??";
|
const char *strMac = NULL, *strRMac = "??:??:??:??:??:??";
|
||||||
|
|
||||||
#ifdef HAVE_PLEDGE /* openbsd */
|
#ifdef __OpenBSD__
|
||||||
if (pledge("stdio wpath", NULL) == -1)
|
if (pledge("stdio wpath", NULL) == -1)
|
||||||
err(errno, "pledge");
|
err(errno, "pledge");
|
||||||
#endif
|
#endif
|
||||||
@@ -96,7 +96,7 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (argc == 3) {
|
if (argc == 3) {
|
||||||
if (strcmp(COMMAND, "dump") == 0) {
|
if (strcmp(COMMAND, "dump") == 0) {
|
||||||
#ifdef HAVE_PLEDGE /* openbsd */
|
#ifdef __OpenBSD__
|
||||||
if (pledge("stdio rpath", NULL) == -1)
|
if (pledge("stdio rpath", NULL) == -1)
|
||||||
err(errno, "pledge");
|
err(errno, "pledge");
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
#ifdef HAVE_PLEDGE
|
#ifdef __OpenBSD__
|
||||||
if (pledge("stdio", NULL) == -1)
|
if (pledge("stdio", NULL) == -1)
|
||||||
err(errno, "pledge");
|
err(errno, "pledge");
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user