1
0
forked from aniani/gmnisrv

config/routing: fix maybe-uninitialized errors

Trivial fix to silence compilation errors on gcc 9.3.0:

  src/config.c: In function ‘conf_ini_handler’:
  src/config.c:154:23: error: ‘routing’ may be used uninitialized in this
  function [-Werror=maybe-uninitialized]
    154 |  enum gmnisrv_routing routing;
        |                       ^~~~~~~

  src/config.c:197:18: error: ‘spec’ may be used uninitialized in this
  function [-Werror=maybe-uninitialized]
    197 |    route->path = strdup(spec);
        |                  ^~~~~~~~~~~~

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin 2020-11-02 09:29:01 -08:00 committed by Drew DeVault
parent b45ddd813b
commit d484ba0ab0

View File

@ -166,6 +166,8 @@ conf_ini_handler(void *user, const char *section,
routing = ROUTE_REGEX; routing = ROUTE_REGEX;
spec = &section[hostln + 1]; spec = &section[hostln + 1];
break; break;
default:
assert(0);
} }
assert(hostln < sizeof(hostname)); assert(hostln < sizeof(hostname));
strncpy(hostname, section, hostln); strncpy(hostname, section, hostln);