]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
partx: fix const qualifier warning in get_max_partno
authorKarel Zak <kzak@redhat.com>
Thu, 27 Nov 2025 15:48:53 +0000 (16:48 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 27 Nov 2025 15:48:53 +0000 (16:48 +0100)
Fix const qualifier discarded warning in get_max_partno().
This warning is reported by gcc 15 which defaults to the C23 standard.

The strrchr() function returns a pointer into a const string, so the
receiving variable must be declared as const char *.

Signed-off-by: Karel Zak <kzak@redhat.com>
disk-utils/partx.c

index f4affe9728e5f57aebdf3ad278b4eaa4b289f5d2..bb1bdc2689534fd37067ec6623b598de0feafec3 100644 (file)
@@ -219,7 +219,8 @@ err:
 
 static int get_max_partno(const char *disk, dev_t devno)
 {
-       char path[PATH_MAX], *parent, *dirname = NULL;
+       char path[PATH_MAX], *dirname = NULL;
+       const char *parent;
        struct stat st;
        DIR *dir;
        struct dirent *d;