| 19 | #define CHECK(cond) if (!(cond)) { printf("errno: %s\n", strerror(errno)); assert(cond); } |
| 20 | |
| 21 | static void create_file(const char *path, const char *buffer, int mode) { |
| 22 | int fd = open(path, O_WRONLY | O_CREAT | O_EXCL, mode); |
| 23 | CHECK(fd >= 0); |
| 24 | |
| 25 | int err = write(fd, buffer, sizeof(char) * strlen(buffer)); |
| 26 | assert(err == (sizeof(char) * strlen(buffer))); |
| 27 | |
| 28 | close(fd); |
| 29 | } |
| 30 | |
| 31 | void setup() { |
| 32 | int err; |