1*4882a593SmuzhiyunFrom 09e325f8296eb9e63dc57ed137f4a9940f164563 Mon Sep 17 00:00:00 2001 2*4882a593SmuzhiyunFrom: Khem Raj <raj.khem@gmail.com> 3*4882a593SmuzhiyunDate: Tue, 21 Mar 2017 17:11:46 -0700 4*4882a593SmuzhiyunSubject: [PATCH] check for fstab.h during configure 5*4882a593Smuzhiyun 6*4882a593Smuzhiyunfstab.h is not universally available, checking it during 7*4882a593Smuzhiyunconfigure creates a knob to disable fstab reads in the 8*4882a593Smuzhiyunplugin 9*4882a593Smuzhiyun 10*4882a593SmuzhiyunMakes it compile/build with musl 11*4882a593Smuzhiyun 12*4882a593SmuzhiyunSigned-off-by: Khem Raj <raj.khem@gmail.com> 13*4882a593Smuzhiyun 14*4882a593SmuzhiyunPatch Reworked for xfce4-mount-plugin 0.6.4->1.1.2 15*4882a593SmuzhiyunSigned-off-by: Andreas Müller <schnitzeltony@googlemail.com> 16*4882a593Smuzhiyun--- 17*4882a593Smuzhiyun configure.ac | 2 + 18*4882a593Smuzhiyun panel-plugin/devices.c | 22 +++++++++++++++++++--- 19*4882a593Smuzhiyun 2 files changed, 21 insertions(+), 3 deletions(-) 20*4882a593Smuzhiyun 21*4882a593Smuzhiyundiff --git a/configure.ac b/configure.ac 22*4882a593Smuzhiyunindex 375e64a..590b7ad 100644 23*4882a593Smuzhiyun--- a/configure.ac 24*4882a593Smuzhiyun+++ b/configure.ac 25*4882a593Smuzhiyun@@ -65,6 +65,9 @@ dnl param.h is part of libc6 on Linux, but important for old-style Unix and espe 26*4882a593Smuzhiyun AC_CHECK_HEADERS([sys/param.h]) 27*4882a593Smuzhiyun AC_CHECK_HEADERS([sys/mount.h]) 28*4882a593Smuzhiyun 29*4882a593Smuzhiyun+dnl make musl happy 30*4882a593Smuzhiyun+AC_CHECK_HEADERS([fstab.h]) 31*4882a593Smuzhiyun+ 32*4882a593Smuzhiyun dnl Add -traditional to output variable CC if using the GNU C compiler and ioctl does not work properly without -traditional. That usually happens when the fixed header files have not been installed on an old system. Leave here commented out to comment in if some older *NIX systems might require it as was recently written on the ML. 33*4882a593Smuzhiyun dnl AC_PROG_GCC_TRADITIONAL 34*4882a593Smuzhiyun 35*4882a593Smuzhiyundiff --git a/panel-plugin/devices.c b/panel-plugin/devices.c 36*4882a593Smuzhiyunindex 797b079..d29df56 100644 37*4882a593Smuzhiyun--- a/panel-plugin/devices.c 38*4882a593Smuzhiyun+++ b/panel-plugin/devices.c 39*4882a593Smuzhiyun@@ -25,7 +25,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 40*4882a593Smuzhiyun #include <config.h> 41*4882a593Smuzhiyun #endif 42*4882a593Smuzhiyun 43*4882a593Smuzhiyun+#if HAVE_FSTAB_H 44*4882a593Smuzhiyun #include <fstab.h> 45*4882a593Smuzhiyun+#endif 46*4882a593Smuzhiyun #include <glib.h> 47*4882a593Smuzhiyun #include <stdio.h> 48*4882a593Smuzhiyun #include <stdlib.h> 49*4882a593Smuzhiyun@@ -468,11 +470,12 @@ disks_new (gboolean include_NFSs, gboolean *showed_fstab_dialog, gint length) 50*4882a593Smuzhiyun { 51*4882a593Smuzhiyun GPtrArray * pdisks; /* to be returned */ 52*4882a593Smuzhiyun t_disk * pdisk; 53*4882a593Smuzhiyun- struct fstab *pfstab; 54*4882a593Smuzhiyun gboolean has_valid_mount_device; 55*4882a593Smuzhiyun 56*4882a593Smuzhiyun pdisks = g_ptr_array_new(); 57*4882a593Smuzhiyun 58*4882a593Smuzhiyun+#if HAVE_FSTAB_H 59*4882a593Smuzhiyun+ struct fstab *pfstab; 60*4882a593Smuzhiyun /* open fstab */ 61*4882a593Smuzhiyun if (setfsent()!=1) 62*4882a593Smuzhiyun { 63*4882a593Smuzhiyun@@ -526,7 +529,20 @@ disks_new (gboolean include_NFSs, gboolean *showed_fstab_dialog, gint length) 64*4882a593Smuzhiyun } /* end for */ 65*4882a593Smuzhiyun 66*4882a593Smuzhiyun endfsent(); /* close file */ 67*4882a593Smuzhiyun- 68*4882a593Smuzhiyun+#else 69*4882a593Smuzhiyun+ /* popup notification dialog */ 70*4882a593Smuzhiyun+ if (! (*showed_fstab_dialog) ) { 71*4882a593Smuzhiyun+ xfce_message_dialog (NULL, 72*4882a593Smuzhiyun+ _("Xfce 4 Mount Plugin"), 73*4882a593Smuzhiyun+ "dialog-info", 74*4882a593Smuzhiyun+ _("Your /etc/fstab could not be read because fstab is not supported. This will severely degrade the plugin's abilities."), 75*4882a593Smuzhiyun+ NULL, 76*4882a593Smuzhiyun+ "gtk-ok", 77*4882a593Smuzhiyun+ GTK_RESPONSE_OK, 78*4882a593Smuzhiyun+ NULL); 79*4882a593Smuzhiyun+ *showed_fstab_dialog = TRUE; 80*4882a593Smuzhiyun+ } 81*4882a593Smuzhiyun+#endif 82*4882a593Smuzhiyun return pdisks; 83*4882a593Smuzhiyun } 84*4882a593Smuzhiyun 85*4882a593Smuzhiyun-- 86*4882a593Smuzhiyun2.9.3 87*4882a593Smuzhiyun 88