blob: e2165c2fa5051feeb9380d56190b20385bb219f2 [file] [log] [blame]
Brad Bishop6e60e8b2018-02-01 10:27:11 -05001From 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 | 1 +
18 panel-plugin/devices.c | 22 +++++++++++++++++++---
19 2 files changed, 20 insertions(+), 3 deletions(-)
20
21diff --git a/configure.ac b/configure.ac
22index b131117..c633fef 100644
23--- a/configure.ac
24+++ b/configure.ac
25@@ -69,6 +69,7 @@ AC_CHECK_HEADERS([sys/socket.h])
26 AC_CHECK_HEADERS([sys/time.h])
27 AC_CHECK_HEADERS([unistd.h])
28 AC_CHECK_HEADERS([sys/sockio.h])
29+AC_CHECK_HEADERS([fstab.h])
30 AC_HEADER_SYS_WAIT
31 AC_PROG_GCC_TRADITIONAL
32 AC_TYPE_SIZE_T
33diff --git a/panel-plugin/devices.c b/panel-plugin/devices.c
34index 797b079..d29df56 100644
35--- a/panel-plugin/devices.c
36+++ b/panel-plugin/devices.c
37@@ -24,8 +24,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
38 #ifdef HAVE_CONFIG_H
39 #include <config.h>
40 #endif
41-
42+#if HAVE_FSTAB_H
43 #include <fstab.h>
44+#endif
45+
46 #include <glib.h>
47 #include <stdio.h>
48 #include <string.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