blob: d81f702891d4acff611b906904f37e61e4fa3438 [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---
Andrew Geissler72956ed2021-01-08 16:11:14 -060017 configure.ac | 2 +
Brad Bishop6e60e8b2018-02-01 10:27:11 -050018 panel-plugin/devices.c | 22 +++++++++++++++++++---
Andrew Geissler72956ed2021-01-08 16:11:14 -060019 2 files changed, 21 insertions(+), 3 deletions(-)
Brad Bishop6e60e8b2018-02-01 10:27:11 -050020
21diff --git a/configure.ac b/configure.ac
Andrew Geissler72956ed2021-01-08 16:11:14 -060022index 375e64a..590b7ad 100644
Brad Bishop6e60e8b2018-02-01 10:27:11 -050023--- a/configure.ac
24+++ b/configure.ac
Andrew Geissler72956ed2021-01-08 16:11:14 -060025@@ -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
Brad Bishop6e60e8b2018-02-01 10:27:11 -050030+AC_CHECK_HEADERS([fstab.h])
Andrew Geissler72956ed2021-01-08 16:11:14 -060031+
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
Brad Bishop6e60e8b2018-02-01 10:27:11 -050035diff --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
Andrew Geissler72956ed2021-01-08 16:11:14 -060039@@ -25,7 +25,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Brad Bishop6e60e8b2018-02-01 10:27:11 -050040 #include <config.h>
41 #endif
Andrew Geissler72956ed2021-01-08 16:11:14 -060042
Brad Bishop6e60e8b2018-02-01 10:27:11 -050043+#if HAVE_FSTAB_H
44 #include <fstab.h>
45+#endif
Brad Bishop6e60e8b2018-02-01 10:27:11 -050046 #include <glib.h>
47 #include <stdio.h>
Andrew Geissler72956ed2021-01-08 16:11:14 -060048 #include <stdlib.h>
Brad Bishop6e60e8b2018-02-01 10:27:11 -050049@@ -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