util/nvmutil: hardened mkstemp

200 retries, not 100.

and open with O_NOFOLLOW and O_CLOEXEC

check X on mkstemp

support more than 6 X in mkstemp

make PATH_LEN 4096

1024 is a bit low

make default mkstemp length 4096

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-19 08:07:47 +00:00
parent 7cc584fe0e
commit 113f2db37c
2 changed files with 33 additions and 13 deletions
+2 -2
View File
@@ -35,7 +35,7 @@ int fchmod(int fd, mode_t mode);
#define MAX_CMD_LEN 50
#ifndef PATH_LEN
#define PATH_LEN 1024
#define PATH_LEN 4096
#endif
#define OFF_ERR 0
@@ -421,7 +421,7 @@ const char *getnvmprogname(void);
*/
char *new_tmpfile(int *fd, int local, const char *path);
int x_i_mkstemp(char *template);
int mkstemp_n(char *template);
char *x_c_tmpdir(void);
int close_on_eintr(int fd);
int fsync_on_eintr(int fd);