summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Ball <nullspoon@oper.io>2024-10-26 21:47:49 -0600
committerAaron Ball <nullspoon@oper.io>2024-10-26 21:47:49 -0600
commitf63fc89d66695d27c5382b7a8b93e279854afc3b (patch)
treee01e71edb45e93685bc262356a21dc4b8c462dcb
parente20fb9d85d0203dbdd7049abd38bcfc3f392e91b (diff)
downloadmotd.sh-f63fc89d66695d27c5382b7a8b93e279854afc3b.tar.gz
motd.sh-f63fc89d66695d27c5382b7a8b93e279854afc3b.tar.xz
main:Fix return code handling for access checks
-rw-r--r--src/main.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c
index 5b0029b..6ca7dfc 100644
--- a/src/main.c
+++ b/src/main.c
@@ -31,17 +31,17 @@ int main() {
cgi_print_header("text/html", 200);
- if(header != NULL && access(header, R_OK))
+ if(header != NULL && access(header, R_OK) == 0)
catfile(header, stdout);
// Print query string file if specified, otherwise default
- if(body != NULL && access(body, R_OK))
+ if(body != NULL && access(body, R_OK) == 0)
catfile(body, stdout);
- else if(defaultpage != NULL && access(defaultpage, R_OK))
+ else if(defaultpage != NULL && access(defaultpage, R_OK) == 0)
catfile(defaultpage, stdout);
- if(footer != NULL && access(footer, R_OK))
+ if(footer != NULL && access(footer, R_OK) == 0)
catfile(footer, stdout);
return 0;
}

Generated by cgit