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