ms-runner/starter/util.c
2025-01-07 21:56:21 +05:00

21 lines
519 B
C

#include "starter.h"
void die_func(const char *fmt, ...)
{
va_list params;
va_start(params, fmt);
vfprintf(stderr, fmt, params);
puts("\n");
va_end(params);
//remove_cgroup();
exit(1);
}
void write_file(char* path, char* line)
{
FILE *f = fopen(path, "w");
if (f == NULL) {die("Failed to open file %s: %m\n", path);}
if (fwrite(line, 1, strlen(line), f) < 0) {die("Failed to write to file %s:\n", path);}
if (fclose(f) != 0) {die("Failed to close file %s: %m\n", path);}
}