mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-18 04:06:26 +02:00
lbutils: don't set USE_OPENAT and USE_URANDOM
these can be set explicitly in the compiler flags, e.g. make CC="cc -DUSE_OPENAT=1 -DUSE_URANDOM=1" these options, if set to 1, will cause you to use the code as if it were running on non-linux systems such as openbsd. of course, some differences will still exist, but this is useful for portability testing when compiling on linux. Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
|
||||
/* for openat2 / fast path: */
|
||||
#ifdef __linux__
|
||||
#if !defined(USE_OPENAT) || \
|
||||
((USE_OPENAT) < 1) /* if 1: use openat, not openat2 */
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE 1
|
||||
#endif
|
||||
@@ -22,6 +24,7 @@
|
||||
#define AT_EMPTY_PATH 0x1000
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
@@ -543,7 +546,8 @@ mkhtemp_try_create(int dirfd,
|
||||
goto err;
|
||||
|
||||
if (type == MKHTEMP_FILE) {
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) && \
|
||||
(!defined(USE_OPENAT) || ((USE_OPENAT) < 1))
|
||||
/* try O_TMPFILE fast path */
|
||||
if (mkhtemp_tmpfile_linux(dirfd,
|
||||
st_dir_first, fname_copy,
|
||||
@@ -652,7 +656,8 @@ err:
|
||||
we still use openat() on bsd, which is
|
||||
still ok with our other mitigations
|
||||
*/
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) && \
|
||||
(!defined(USE_OPENAT) || ((USE_OPENAT) < 1))
|
||||
int
|
||||
mkhtemp_tmpfile_linux(int dirfd,
|
||||
struct stat *st_dir_first,
|
||||
|
||||
Reference in New Issue
Block a user