aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-01-02 22:38:28 -0800
committerKartik K. Agaram <vc@akkartik.com>2022-01-02 22:38:28 -0800
commite3cef7ee5686d335202c73b5316c2b1f74151cfc (patch)
tree14733295726d4d9bad0d3f17001ce569605f6f67 /src
parentb97291602b767e0846462700fe4d87245feb8684 (diff)
downloadteliva-e3cef7ee5686d335202c73b5316c2b1f74151cfc.tar.gz
bugfix: policies must end in newline
I believe kilo kinda naturally enforces that. We'll see.
Diffstat (limited to 'src')
-rw-r--r--src/teliva.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/teliva.c b/src/teliva.c
index 885629b..822ff05 100644
--- a/src/teliva.c
+++ b/src/teliva.c
@@ -51,7 +51,7 @@ static const char* trim(const char* in) {
return result;
}
-const char* default_file_operations_predicate_body = "return false";
+const char* default_file_operations_predicate_body = "return false\n";
const char* file_operations_predicate_body;
int net_operations_permitted = false;
@@ -102,7 +102,7 @@ static void render_permissions(lua_State* L) {
attrset(A_NORMAL);
mvaddstr(LINES-1, COLS-12, "");
int file_colors = COLOR_PAIR_SAFE;
- if (file_operations_predicate_body && strcmp(default_file_operations_predicate_body, trim(file_operations_predicate_body)) != 0)
+ if (file_operations_predicate_body && strcmp("return false", trim(file_operations_predicate_body)) != 0)
file_colors = COLOR_PAIR_WARN;
int net_colors = net_operations_permitted ? COLOR_PAIR_WARN : COLOR_PAIR_SAFE;
if (file_colors == COLOR_PAIR_WARN && net_colors == COLOR_PAIR_WARN) {
@@ -1128,7 +1128,7 @@ static void render_permissions_screen() {
attroff(COLOR_PAIR(net_colors));
mvaddstr(y, 30, "(No nuance available for network operations.)");
- int file_operations_safe = strcmp(default_file_operations_predicate_body, trim(file_operations_predicate_body)) == 0;
+ int file_operations_safe = strcmp("return false", trim(file_operations_predicate_body)) == 0;
int net_operations_safe = (net_operations_permitted == 0);
int file_operations_unsafe = strcmp("return true", trim(file_operations_predicate_body)) == 0;
int net_operations_unsafe = (net_operations_permitted != 0);