| 15 | #include <sys/stat.h> |
| 16 | |
| 17 | static void create_file(const char *path, const char *buffer, int mode) { |
| 18 | printf("creating: %s\n", path); |
| 19 | int fd = open(path, O_WRONLY | O_CREAT | O_EXCL, mode); |
| 20 | assert(fd >= 0); |
| 21 | |
| 22 | int err = write(fd, buffer, sizeof(char) * strlen(buffer)); |
| 23 | assert(err == (sizeof(char) * strlen(buffer))); |
| 24 | |
| 25 | close(fd); |
| 26 | } |
| 27 | |
| 28 | void setup() { |
| 29 | mkdir("working", 0777); |