summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index ffce943..6395acd 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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
18int main() { 26int 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);