1From 09e325f8296eb9e63dc57ed137f4a9940f164563 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 21 Mar 2017 17:11:46 -0700
4Subject: [PATCH] check for fstab.h during configure
5
6fstab.h is not universally available, checking it during
7configure creates a knob to disable fstab reads in the
8plugin
9
10Makes it compile/build with musl
11
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13
14Patch Reworked for xfce4-mount-plugin 0.6.4->1.1.2
15Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
16---
17 configure.ac           |  2 +
18 panel-plugin/devices.c | 22 +++++++++++++++++++---
19 2 files changed, 21 insertions(+), 3 deletions(-)
20
21diff --git a/configure.ac b/configure.ac
22index 375e64a..590b7ad 100644
23--- a/configure.ac
24+++ b/configure.ac
25@@ -65,6 +65,9 @@ dnl param.h is part of libc6 on Linux, but important for old-style Unix and espe
26 AC_CHECK_HEADERS([sys/param.h])
27 AC_CHECK_HEADERS([sys/mount.h])
28
29+dnl make musl happy
30+AC_CHECK_HEADERS([fstab.h])
31+
32 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 dnl AC_PROG_GCC_TRADITIONAL
34
35diff --git a/panel-plugin/devices.c b/panel-plugin/devices.c
36index 797b079..d29df56 100644
37--- a/panel-plugin/devices.c
38+++ b/panel-plugin/devices.c
39@@ -25,7 +25,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
40 #include <config.h>
41 #endif
42
43+#if HAVE_FSTAB_H
44 #include <fstab.h>
45+#endif
46 #include <glib.h>
47 #include <stdio.h>
48 #include <stdlib.h>
49@@ -468,11 +470,12 @@ disks_new (gboolean include_NFSs, gboolean *showed_fstab_dialog, gint length)
50 {
51     GPtrArray * pdisks; /* to be returned */
52     t_disk * pdisk;
53-    struct fstab *pfstab;
54     gboolean has_valid_mount_device;
55
56     pdisks = g_ptr_array_new();
57
58+#if HAVE_FSTAB_H
59+    struct fstab *pfstab;
60     /* open fstab */
61     if (setfsent()!=1)
62     {
63@@ -526,7 +529,20 @@ disks_new (gboolean include_NFSs, gboolean *showed_fstab_dialog, gint length)
64     } /* end for */
65
66     endfsent(); /* close file */
67-
68+#else
69+        /* popup notification dialog */
70+        if (! (*showed_fstab_dialog) ) {
71+            xfce_message_dialog (NULL,
72+                               _("Xfce 4 Mount Plugin"),
73+                               "dialog-info",
74+                               _("Your /etc/fstab could not be read because fstab is not supported. This will severely degrade the plugin's abilities."),
75+                               NULL,
76+                               "gtk-ok",
77+                               GTK_RESPONSE_OK,
78+                               NULL);
79+             *showed_fstab_dialog = TRUE;
80+         }
81+#endif
82     return pdisks;
83 }
84
85--
862.9.3
87
88