int fd;
char *readtype, *modfilename;
char *buf, *walk;
+ size_t i;
if (strncmp(modstr, "subscribe", 9) == 0)
modstr += 9;
*addrptr = xstrdup(strsep(&walk, "\n"));
readtype = strsep(&walk, "\n");
- for (size_t i = 0; i < NELEM(subtypes); i++) {
+ for (i = 0; i < NELEM(subtypes); i++) {
if (subtypes[i] == NULL)
continue;
if (strcmp(subtypes[i], readtype) == 0) {
*subtypeptr = i;
- goto freedone;
+ break;
}
}
- log_error(LOG_ARGS, "Type %s not valid in %s/%s", readtype,
- ml->dir, modfilename);
- exit(EXIT_FAILURE);
+ if (i == NELEM(subtypes)) {
+ log_error(LOG_ARGS, "Type %s not valid in %s/%s", readtype,
+ ml->dir, modfilename);
+ exit(EXIT_FAILURE);
+ }
-freedone:
free(buf);
unlinkat(ml->fd, modfilename, 0);
free(modfilename);