summaryrefslogtreecommitdiff
path: root/util/libreboot-utils/include
diff options
context:
space:
mode:
Diffstat (limited to 'util/libreboot-utils/include')
-rw-r--r--util/libreboot-utils/include/common.h30
1 files changed, 25 insertions, 5 deletions
diff --git a/util/libreboot-utils/include/common.h b/util/libreboot-utils/include/common.h
index b26448db..93eded99 100644
--- a/util/libreboot-utils/include/common.h
+++ b/util/libreboot-utils/include/common.h
@@ -287,6 +287,11 @@ struct xfile {
unsigned char bufcmp[GBE_BUF_SIZE]; /* compare gbe/tmp/reads */
unsigned char pad[GBE_WORK_SIZE]; /* the file that wouldn't die */
+
+ /* we later rename in-place, using old fd. renameat() */
+ int dirfd;
+ char *base;
+ char *tmpbase;
};
/* Command table, MAC address, files
@@ -490,16 +495,21 @@ int try_err(int loop_err, int errval);
void usage(void);
void err_no_cleanup(int nvm_errval, const char *msg, ...);
-void err(int nvm_errval, const char *msg, ...);
+void b0rk(int nvm_errval, const char *msg, ...);
int exit_cleanup(void);
const char *getnvmprogname(void);
+void err_mkhtemp(int stfu, int errval, const char *msg, ...);
+
/* libc hardening
*/
-int new_tmpfile(int *fd, char **path);
-int new_tmpdir(int *fd, char **path);
-int new_tmp_common(int *fd, char **path, int type);
+int new_tmpfile(int *fd, char **path, char *tmpdir,
+ const char *template);
+int new_tmpdir(int *fd, char **path, char *tmpdir,
+ const char *template);
+int new_tmp_common(int *fd, char **path, int type,
+ char *tmpdir, const char *template);
int mkhtemp_try_create(int dirfd,
struct stat *st_dir_initial,
char *fname_copy,
@@ -508,6 +518,14 @@ int mkhtemp_try_create(int dirfd,
int *fd,
struct stat *st,
int type);
+int
+mkhtemp_tmpfile_linux(int dirfd,
+ struct stat *st_dir_initial,
+ char *fname_copy,
+ char *p,
+ size_t xc,
+ int *fd,
+ struct stat *st);
int mkhtemp(int *fd, struct stat *st,
char *template, int dirfd, const char *fname,
struct stat *st_dir_initial, int type);
@@ -517,7 +535,8 @@ int world_writeable_and_sticky(const char *s,
int same_dir(const char *a, const char *b);
int tmpdir_policy(const char *path,
int *allow_noworld_unsticky);
-char *env_tmpdir(int always_sticky, char **tmpdir);
+char *env_tmpdir(int always_sticky, char **tmpdir,
+ char *override_tmpdir);
int secure_file(int *fd,
struct stat *st,
struct stat *expected,
@@ -547,6 +566,7 @@ int mkdirat_on_eintr(int dirfd,
const char *pathname, mode_t mode);
int if_err(int condition, int errval);
int if_err_sys(int condition);
+char *lbgetprogname(char *argv0);
/* asserts */