From: Ben Walton Date: Tue, 3 Jun 2014 22:01:14 +0000 (+0100) Subject: mountlist: avoid hasmntopt const type warning on solaris X-Git-Tag: v1.0~7361 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=502809019bd2ca3ce3d041d18c35ce9420eedb72;p=gnulib.git mountlist: avoid hasmntopt const type warning on solaris * lib/mountlist.c: Solaris defines the OPT param of hasmntopt() with char * instead of const char *. Passing the constant string "ignore" generates a compiler warning. For Solaris cast MNT_IGNORE to avoid the warning. Signed-off-by: Ben Walton --- diff --git a/ChangeLog b/ChangeLog index 97da78d035..5364627462 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2014-06-06 Ben Walton + + mountlist: avoid hasmntopt const type warning on solaris + * lib/mountlist.c: Solaris defines the OPT param of hasmntopt() + with char * instead of const char *. Passing the constant string + "ignore" generates a compiler warning. For Solaris cast MNT_IGNORE + to avoid the warning. + 2014-06-04 Eric Blake maintainer-makefile: delete obsolete code diff --git a/lib/mountlist.c b/lib/mountlist.c index 78af951818..b3be011a1b 100644 --- a/lib/mountlist.c +++ b/lib/mountlist.c @@ -134,7 +134,13 @@ #undef MNT_IGNORE #ifdef MNTOPT_IGNORE -# define MNT_IGNORE(M) hasmntopt (M, MNTOPT_IGNORE) +# if defined __sun && defined __SVR4 +/* Solaris defines hasmntopt(struct mnttab *, char *) + while it is otherwise hasmntopt(struct mnttab *, const char *). */ +# define MNT_IGNORE(M) hasmntopt (M, (char *) MNTOPT_IGNORE) +# else +# define MNT_IGNORE(M) hasmntopt (M, MNTOPT_IGNORE) +# endif #else # define MNT_IGNORE(M) 0 #endif