]> 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>
Mon, 8 Dec 2025 13:48:07 +0000 (14: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>
(cherry picked from commit 4c94ce5d05d97420df7a512bbbaee8c4017414ae)

disk-utils/partx.c

index 347d5daad303d688f2da4d6778f5175689c4f56a..a2df5d4c0f27db5da265c95c716d3263db617ff0 100644 (file)
@@ -218,7 +218,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;