mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 15:44:21 +01:00
common/utils: introduce tmpdir_mkstemp; use it
Various unit tests were creating temporary files unconditionally in /tmp and were not cleaning up after themselves. Introduce a new variant of mkstemp(3p) that respects the TMPDIR environment variable, and use it in the offending unit tests. This allows each test run to use a dedicated TMPDIR that can be cleaned up after the run. Changelog-None Signed-off-by: Matt Whitlock <c-lightning@mattwhitlock.name>
This commit is contained in:
committed by
Rusty Russell
parent
5284ee4dae
commit
1f79aad830
@@ -152,4 +152,8 @@ STRUCTEQ_DEF(ripemd160, 0, u);
|
||||
/* Context which all wally allocations use (see common/setup.c) */
|
||||
extern const tal_t *wally_tal_ctx;
|
||||
|
||||
/* Like mkstemp but resolves template relative to $TMPDIR (or /tmp if unset).
|
||||
* Returns created temporary path name at *created if successful. */
|
||||
int tmpdir_mkstemp(const tal_t *ctx, const char *template TAKES, char **created);
|
||||
|
||||
#endif /* LIGHTNING_COMMON_UTILS_H */
|
||||
|
||||
Reference in New Issue
Block a user