summaryrefslogtreecommitdiff
path: root/util/libreboot-utils/lib
AgeCommit message (Collapse)Author
54 min.util/nvmutil: use renameat for atomic writemkhtemp-wipLeah Rowe
not rename(). use renameat() this re-uses the logic added for mkhtemp. this will later enable more stringent integrity checks, though we already verify the integrity of a file after writing it back, and renameat is always tied to the descriptor, so it's fine. Signed-off-by: Leah Rowe <leah@libreboot.org>
77 min.improve the error messageLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
87 min.util/nvmutil: never do cross-filesystem movesLeah Rowe
make a local TMPDIR instead, where gbe.bin is. this avoids the EXDEV errno, so we don't have to handle it, and it's just better performant for everyone. Signed-off-by: Leah Rowe <leah@libreboot.org>
3 hoursTODO: exdev handling still broken on nvmutilLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
3 hoursutil/nvmutil: use new fs_open functions for gbeLeah Rowe
this unifies nvmutil's file handling with the handling used by mkhtemp. a special function has been written for this. this allows greater flexibility since we can more easily check the integrity of a file at inode/dev level; this complements nvmutil's existing content-based verification. (this also fixes nvmutil, so that gbe files can be changed again. mkhtemp broke it while i was writing it, but now everything works again) Signed-off-by: Leah Rowe <leah@libreboot.org>
4 hoursmkhtemp: show progname on errorLeah Rowe
i have my own getprogname implementation, because not every libc is good enough to include one. Signed-off-by: Leah Rowe <leah@libreboot.org>
10 hourscommentLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
10 hourslibreboot-utils: general code cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
13 hoursmkhtemp: unified non-error close handlingLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
15 hoursutil/nvmutil: make it compile againLeah Rowe
i was reorganising the state machine (singleton) used for data, and part of what i wanted lead to mkhtemp being written. Signed-off-by: Leah Rowe <leah@libreboot.org>
16 hoursnvmutil/state: remove unnecessary checkLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
17 hoursadd comment about mkhtemp calling conventionLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
18 hoursutil/mkhtemp: show path on error accessing itLeah Rowe
a bit naughty the way i do it, but it works. without this, the message gets clobbered by EINVAL due to a bad call to vprintf in the err function. in this way, we ensure that there is a path, and thus the errno does not get clobbered. i also removed the EPERM setting in the env_tmpdir function, which also clobbered errno. with this fix, if TMPDIR is set but invalid, it should now show the error reliably. Signed-off-by: Leah Rowe <leah@libreboot.org>
18 hourslib/mkhtemp.c: use standard suffixLeah Rowe
it may seem counterintuitive that a shorter suffix is better, but i think we should ideally look just like what is made my any other tool, and other mktemp tools generate: tmp.XXXXXXXXXX this is the default, but of course it could be changed. Signed-off-by: Leah Rowe <leah@libreboot.org>
19 hoursutil/mkhtemp: new utility (hardened mktemp)Leah Rowe
part of the same code library as nvmutil. as part of this, i renamed util/nvmutil to util/libreboot-utils/ because it is now a multi-utility codebase. this is more efficient, since i also wish to use mkhtemp (function) in nvmutil. Signed-off-by: Leah Rowe <leah@libreboot.org>