summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-08-22 15:03:02 +0000
committerLaurent Bercot <ska@appnovation.com>2023-08-22 15:03:02 +0000
commit921a959bc43275dc2a39ac3cc95b738d7ea98cf2 (patch)
tree0300a05ac22a33b1b44a052d093f48a8600a3054
parent8dd7b34dee5407324616dad6405d50aae4998b32 (diff)
downloadtipidee-921a959bc43275dc2a39ac3cc95b738d7ea98cf2.tar.xz
Respond 403 on EACCES
Signed-off-by: Laurent Bercot <ska@appnovation.com>
-rw-r--r--src/tipideed/regular.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/tipideed/regular.c b/src/tipideed/regular.c
index 1ac1095..df4b157 100644
--- a/src/tipideed/regular.c
+++ b/src/tipideed/regular.c
@@ -1,5 +1,7 @@
/* ISC license. */
+#include <errno.h>
+
#include <skalibs/uint64.h>
#include <skalibs/types.h>
#include <skalibs/buffer.h>
@@ -39,7 +41,12 @@ int respond_regular (tipidee_rql const *rql, char const *fn, uint64_t size, tipi
if (fd == -1)
{
buffer_unput(buffer_1, n) ;
- die500sys(rql, 111, "open ", fn) ;
+ if (errno == EACCES)
+ {
+ respond_403(rql) ;
+ return 0 ;
+ }
+ else die500sys(rql, 111, "open ", fn) ;
}
send_file(fd, size, fn) ;
fd_close(fd) ;