On Solaris 11 OmniOS, we've been seeing this warning for a long time:

../../gllib/mountlist.c: In function 'read_file_system_list':
../../gllib/mountlist.c:887:40: warning: passing argument 1 of 'hasmntopt' from 
incompatible pointer type [-Wincompatible-pointer-types]

With gcc 14, this warning becomes an error.

This patch fixes it.


2025-03-24  Bruno Haible  <br...@clisp.org>

        mountlist: Fix a compilation error on Solaris with gcc 14.
        * lib/mountlist.c (read_file_system_list): Cast the argument of
        MNT_IGNORE.

diff --git a/lib/mountlist.c b/lib/mountlist.c
index fae9bb50cb..72bd3f3bb6 100644
--- a/lib/mountlist.c
+++ b/lib/mountlist.c
@@ -884,7 +884,9 @@ read_file_system_list (bool need_fs_type)
             me->me_mntroot = NULL;
             me->me_type = xstrdup (mnt.mnt_fstype);
             me->me_type_malloced = 1;
-            me->me_dummy = MNT_IGNORE (&mnt) != 0;
+            /* The cast from 'struct extmnttab *' to 'struct mnttab *' is OK
+               because 'struct extmnttab' extends 'struct mnttab'.  */
+            me->me_dummy = MNT_IGNORE ((struct mnttab *) &mnt) != 0;
             me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
             me->me_dev = makedev (mnt.mnt_major, mnt.mnt_minor);
 




Reply via email to