test: clean up any lingering core file after systemf() test

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2021-10-03 13:22:01 +02:00
parent 3d2a975f11
commit d4649b8284
+12
View File
@@ -1,6 +1,16 @@
#include <err.h>
#include "check.h"
/*
* Depending on the system and default shell, `kill -QUIT $$` (below)
* may leave a core file, so we need to clean that up here to prevent
* the distcleancheck target from failing.
*/
static void cleanup(void)
{
remove("core");
}
int main(void)
{
struct { char *cmd; int rc; } list[] = {
@@ -12,6 +22,8 @@ int main(void)
{ "kill -INT $$", -1 }
};
atexit(cleanup);
for (size_t i = 0; i < NELEMS(list); i++) {
int rc;