]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
zonefile: add libgen.h for basename(), cleanup
authorDaniel Salzman <daniel.salzman@nic.cz>
Mon, 2 Jun 2025 14:33:17 +0000 (16:33 +0200)
committerDaniel Salzman <daniel.salzman@nic.cz>
Mon, 2 Jun 2025 14:33:17 +0000 (16:33 +0200)
src/knot/zone/zonefile.c
src/utils/kzonecheck/main.c

index a76a6deb4664882a0ddd5aa4965036456093ff1a..25431c38919767ff8ab2e36c049d8593179f3f6c 100644 (file)
@@ -4,15 +4,16 @@
  */
 
 #include <assert.h>
+#include <errno.h>
+#include <inttypes.h>
+#include <libgen.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <time.h>
 #include <unistd.h>
-#include <inttypes.h>
 
 #include "libknot/libknot.h"
 #include "contrib/files.h"
@@ -159,7 +160,7 @@ int zonefile_open(zloader_t *loader, const char *source, const knot_dname_t *ori
        uint8_t origin_buf[1 + KNOT_DNAME_MAXLEN];
        if (origin == NULL) { // Origin autodetection based on SOA owner and source.
                const char *ext = ".zone";
-               char *origin_str = basename(source);
+               char *origin_str = basename((char *)source);
                if (strcmp(origin_str + strlen(origin_str) - strlen(ext), ext) == 0) {
                        origin_str = strndup(origin_str, strlen(origin_str) - strlen(ext));
                } else {
index ccb88365c24e8de22797efa847aa47dcdb0bfd35..56b95506a4e0a21eef9e8bab03ef8e98b7d2be2b 100644 (file)
@@ -4,7 +4,6 @@
  */
 
 #include <getopt.h>
-#include <libgen.h>
 #include <stdio.h>
 
 #include "contrib/strtonum.h"