summaryrefslogtreecommitdiff
path: root/src/libtipidee
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-10-26 15:00:30 +0000
committerLaurent Bercot <ska@appnovation.com>2023-10-26 15:00:30 +0000
commitd05b3963381a4cd0329bced938d79a23bb392658 (patch)
tree0033b18d74eb24b497d7e258b85e7c7093541d2b /src/libtipidee
parent3dd236a9d8ff1fa0a754b359ceda12e85a123fff (diff)
downloadtipidee-d05b3963381a4cd0329bced938d79a23bb392658.tar.xz
Some more fixes
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/libtipidee')
-rw-r--r--src/libtipidee/tipidee_conf_get_redirection.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/libtipidee/tipidee_conf_get_redirection.c b/src/libtipidee/tipidee_conf_get_redirection.c
index 9d40de2..b117481 100644
--- a/src/libtipidee/tipidee_conf_get_redirection.c
+++ b/src/libtipidee/tipidee_conf_get_redirection.c
@@ -11,19 +11,20 @@
static int get_redir (tipidee_conf const *conf, size_t minl, char *key, size_t l, char const *path, tipidee_redirection *r)
{
- char const *v ;
+ char const *v = 0 ;
key[0] = 'R' ;
key[l] = '/' ;
- for (;;)
+ errno = ENOENT ;
+ while (!v)
{
- while (l > minl && key[l] != '/') l-- ;
- if (l <= minl) return 0 ;
+ if (errno != ENOENT) return -1 ;
+ while (l >= minl && key[l] != '/') l-- ;
+ if (l < minl) break ;
key[l--] = 0 ;
v = tipidee_conf_get_string(conf, key) ;
- if (v) break ;
- if (errno != ENOENT) return -1 ;
key[0] = 'r' ;
}
+ if (!v) return 0 ;
if (v[0] < '@' || v[0] > 'C') return (errno = EPROTO, -1) ;
r->type = v[0] & ~'@' ;
r->location = v+1 ;