summaryrefslogtreecommitdiff
path: root/src/config
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-08-29 16:30:15 +0000
committerLaurent Bercot <ska@appnovation.com>2023-08-29 16:30:15 +0000
commit0691bcbd11897694a604f99fa58af6b4286c7195 (patch)
treea5259e0b1118c5d294cb4bfb77fa3d25fed4d121 /src/config
parente6ada0b74352f77124a682d98c6d842fd5c44b45 (diff)
downloadtipidee-0691bcbd11897694a604f99fa58af6b4286c7195.tar.xz
More examples, some fixes, some more doc
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/config')
-rw-r--r--src/config/lexparse.c4
-rw-r--r--src/config/tipidee-config-internal.h2
-rw-r--r--src/config/tipidee-config-preprocess.c4
-rw-r--r--src/config/tipidee-config.c7
4 files changed, 6 insertions, 11 deletions
diff --git a/src/config/lexparse.c b/src/config/lexparse.c
index a7ed5b2..da9d7f5 100644
--- a/src/config/lexparse.c
+++ b/src/config/lexparse.c
@@ -99,7 +99,7 @@ static inline void parse_global (char const *s, size_t const *word, size_t n, md
{ .name = "verbosity", .key = "G:verbosity", .type = 0 },
{ .name = "write_timeout", .key = "G:write_timeout", .type = 0 }
} ;
- struct globalkey_s *gl ;
+ struct globalkey_s const *gl ;
if (n < 2)
strerr_dief8x(1, "too ", "few", " arguments to directive ", "global", " in file ", g.storage.s + md->filepos, " line ", md->linefmt) ;
gl = bsearch(s + word[0], globalkeys, sizeof(globalkeys)/sizeof(struct globalkey_s), sizeof(struct globalkey_s), &globalkey_cmp) ;
@@ -194,7 +194,7 @@ static inline void parse_redirect (char const *s, size_t const *word, size_t n,
static void parse_bitattr (char const *s, size_t const *word, size_t n, char const *domain, size_t domainlen, mdt const *md, unsigned int bit, int set)
{
- static char const *attr[3][2] = { { "noncgi", "cgi" }, { "nonnph", "nph", }, { "noauth", "basic-auth" } } ;
+ static char const *const attr[3][2] = { { "noncgi", "cgi" }, { "nonnph", "nph", }, { "noauth", "basic-auth" } } ;
uint8_t mask = (uint8_t)0x01 << bit ;
if (n != 1)
strerr_dief8x(1, "too ", n > 1 ? "many" : "few", " arguments to directive ", attr[bit][set], " in file ", g.storage.s + md->filepos, " line ", md->linefmt) ;
diff --git a/src/config/tipidee-config-internal.h b/src/config/tipidee-config-internal.h
index e274f94..154c6ff 100644
--- a/src/config/tipidee-config-internal.h
+++ b/src/config/tipidee-config-internal.h
@@ -35,8 +35,6 @@ extern struct global_s g ;
extern void confnode_start (confnode *, char const *, size_t, uint32_t) ;
extern void confnode_add (confnode *, char const *, size_t) ;
-#define confnode_adds(node, s) confnode_add(node, (s), strlen(s))
-#define confnode_add0(node) confnode_add((node), "", 1)
/* conftree */
diff --git a/src/config/tipidee-config-preprocess.c b/src/config/tipidee-config-preprocess.c
index 6ac4812..03b54f1 100644
--- a/src/config/tipidee-config-preprocess.c
+++ b/src/config/tipidee-config-preprocess.c
@@ -206,9 +206,11 @@ static void includefromhere (char const *file)
switch (cmd)
{
case 2 :
+ if (namesa.s[d] & 2)
+ strerr_dief5x(3, "in ", namesa.s + d + 1, " line ", linefmt, ": extra !included: directive") ;
if (!strcmp(sa.s + sastart, "unique")) namesa.s[d] |= 3 ;
else if (!strcmp(sa.s + sastart, "multiple")) namesa.s[d] |= 2 ;
- else strerr_dief6x(3, "in ", namesa.s + d + 1, " line ", linefmt, "invalid !included: argument: ", sa.s + sastart) ;
+ else strerr_dief6x(3, "in ", namesa.s + d + 1, " line ", linefmt, ": invalid !included: argument: ", sa.s + sastart) ;
break ;
case 1 :
case 0 :
diff --git a/src/config/tipidee-config.c b/src/config/tipidee-config.c
index be13e39..36b1c03 100644
--- a/src/config/tipidee-config.c
+++ b/src/config/tipidee-config.c
@@ -52,11 +52,6 @@ static inline void conf_output (char const *ofile, unsigned int omode)
memcpy(otmp + olen, ":XXXXXX", 8) ;
fdw = mkstemp(otmp) ;
if (fdw == -1) strerr_diefu3sys(111, "open ", otmp, " for writing") ;
- if (coe(fdw) == -1)
- {
- unlink_void(otmp) ;
- strerr_diefu2sys(111, "coe ", otmp) ;
- }
if (!cdbmake_start(&cm, fdw))
{
unlink_void(otmp) ;
@@ -77,7 +72,7 @@ static inline void conf_output (char const *ofile, unsigned int omode)
unlink_void(otmp) ;
strerr_diefu2sys(111, "fsync ", otmp) ;
}
- if (fchmod(fdw, omode & 0755) == -1)
+ if (fchmod(fdw, omode & 0777) == -1)
{
unlink_void(otmp) ;
strerr_diefu2sys(111, "fchmod ", otmp) ;