blob: 64f06cebb5bf7a723c2ad3b6653333c8d256aaa9 [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
Patrick Williams8e7b46e2023-05-01 14:19:06 -050012Upstream-Status: Pending
Brad Bishop6e60e8b2018-02-01 10:27:11 -050013Signed-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---
Andrew Geissler72956ed2021-01-08 16:11:14 -060018 configure.ac | 2 +
Brad Bishop6e60e8b2018-02-01 10:27:11 -050019 panel-plugin/devices.c | 22 +++++++++++++++++++---
Andrew Geissler72956ed2021-01-08 16:11:14 -060020 2 files changed, 21 insertions(+), 3 deletions(-)
Brad Bishop6e60e8b2018-02-01 10:27:11 -050021
22diff --git a/configure.ac b/configure.ac
Andrew Geissler72956ed2021-01-08 16:11:14 -060023index 375e64a..590b7ad 100644
Brad Bishop6e60e8b2018-02-01 10:27:11 -050024--- a/configure.ac
25+++ b/configure.ac
Andrew Geissler72956ed2021-01-08 16:11:14 -060026@@ -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
Brad Bishop6e60e8b2018-02-01 10:27:11 -050031+AC_CHECK_HEADERS([fstab.h])
Andrew Geissler72956ed2021-01-08 16:11:14 -060032+
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
Brad Bishop6e60e8b2018-02-01 10:27:11 -050036diff --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
Andrew Geissler72956ed2021-01-08 16:11:14 -060040@@ -25,7 +25,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Brad Bishop6e60e8b2018-02-01 10:27:11 -050041 #include <config.h>
42 #endif
Andrew Geissler72956ed2021-01-08 16:11:14 -060043
Brad Bishop6e60e8b2018-02-01 10:27:11 -050044+#if HAVE_FSTAB_H
45 #include <fstab.h>
46+#endif
Brad Bishop6e60e8b2018-02-01 10:27:11 -050047 #include <glib.h>
48 #include <stdio.h>
Andrew Geissler72956ed2021-01-08 16:11:14 -060049 #include <stdlib.h>
Brad Bishop6e60e8b2018-02-01 10:27:11 -050050@@ -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