aboutsummaryrefslogtreecommitdiffstats
path: root/meta-xfce/recipes-panel-plugins/mount/xfce4-mount-plugin/0001-check-for-fstab.h-during-configure.patch
blob: e2165c2fa5051feeb9380d56190b20385bb219f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
From 09e325f8296eb9e63dc57ed137f4a9940f164563 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 21 Mar 2017 17:11:46 -0700
Subject: [PATCH] check for fstab.h during configure

fstab.h is not universally available, checking it during
configure creates a knob to disable fstab reads in the
plugin

Makes it compile/build with musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>

Patch Reworked for xfce4-mount-plugin 0.6.4->1.1.2
Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
---
 configure.ac           |  1 +
 panel-plugin/devices.c | 22 +++++++++++++++++++---
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index b131117..c633fef 100644
--- a/configure.ac
+++ b/configure.ac
@@ -69,6 +69,7 @@ AC_CHECK_HEADERS([sys/socket.h])
 AC_CHECK_HEADERS([sys/time.h])
 AC_CHECK_HEADERS([unistd.h])
 AC_CHECK_HEADERS([sys/sockio.h])
+AC_CHECK_HEADERS([fstab.h])
 AC_HEADER_SYS_WAIT
 AC_PROG_GCC_TRADITIONAL
 AC_TYPE_SIZE_T
diff --git a/panel-plugin/devices.c b/panel-plugin/devices.c
index 797b079..d29df56 100644
--- a/panel-plugin/devices.c
+++ b/panel-plugin/devices.c
@@ -24,8 +24,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
-
+#if HAVE_FSTAB_H
 #include <fstab.h>
+#endif
+
 #include <glib.h>
 #include <stdio.h>
 #include <string.h>
@@ -468,11 +470,12 @@ disks_new (gboolean include_NFSs, gboolean *showed_fstab_dialog, gint length)
 {
     GPtrArray * pdisks; /* to be returned */
     t_disk * pdisk;
-    struct fstab *pfstab;
     gboolean has_valid_mount_device;
 
     pdisks = g_ptr_array_new();
 
+#if HAVE_FSTAB_H
+    struct fstab *pfstab;
     /* open fstab */
     if (setfsent()!=1)
     {
@@ -526,7 +529,20 @@ disks_new (gboolean include_NFSs, gboolean *showed_fstab_dialog, gint length)
     } /* end for */
 
     endfsent(); /* close file */
-
+#else
+        /* popup notification dialog */
+        if (! (*showed_fstab_dialog) ) {
+            xfce_message_dialog (NULL,
+                               _("Xfce 4 Mount Plugin"),
+                               "dialog-info",
+                               _("Your /etc/fstab could not be read because fstab is not supported. This will severely degrade the plugin's abilities."),
+                               NULL,
+                               "gtk-ok",
+                               GTK_RESPONSE_OK,
+                               NULL);
+             *showed_fstab_dialog = TRUE;
+         }
+#endif
     return pdisks;
 }
 
-- 
2.9.3