Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 1 | From 09e325f8296eb9e63dc57ed137f4a9940f164563 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Tue, 21 Mar 2017 17:11:46 -0700 |
| 4 | Subject: [PATCH] check for fstab.h during configure |
| 5 | |
| 6 | fstab.h is not universally available, checking it during |
| 7 | configure creates a knob to disable fstab reads in the |
| 8 | plugin |
| 9 | |
| 10 | Makes it compile/build with musl |
| 11 | |
| 12 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 13 | |
| 14 | Patch Reworked for xfce4-mount-plugin 0.6.4->1.1.2 |
| 15 | Signed-off-by: Andreas MΓΌller <schnitzeltony@googlemail.com> |
| 16 | --- |
Andrew Geissler | 72956ed | 2021-01-08 16:11:14 -0600 | [diff] [blame] | 17 | configure.ac | 2 + |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 18 | panel-plugin/devices.c | 22 +++++++++++++++++++--- |
Andrew Geissler | 72956ed | 2021-01-08 16:11:14 -0600 | [diff] [blame] | 19 | 2 files changed, 21 insertions(+), 3 deletions(-) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 20 | |
| 21 | diff --git a/configure.ac b/configure.ac |
Andrew Geissler | 72956ed | 2021-01-08 16:11:14 -0600 | [diff] [blame] | 22 | index 375e64a..590b7ad 100644 |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 23 | --- a/configure.ac |
| 24 | +++ b/configure.ac |
Andrew Geissler | 72956ed | 2021-01-08 16:11:14 -0600 | [diff] [blame] | 25 | @@ -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 Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 30 | +AC_CHECK_HEADERS([fstab.h]) |
Andrew Geissler | 72956ed | 2021-01-08 16:11:14 -0600 | [diff] [blame] | 31 | + |
| 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 Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 35 | diff --git a/panel-plugin/devices.c b/panel-plugin/devices.c |
| 36 | index 797b079..d29df56 100644 |
| 37 | --- a/panel-plugin/devices.c |
| 38 | +++ b/panel-plugin/devices.c |
Andrew Geissler | 72956ed | 2021-01-08 16:11:14 -0600 | [diff] [blame] | 39 | @@ -25,7 +25,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 40 | #include <config.h> |
| 41 | #endif |
Andrew Geissler | 72956ed | 2021-01-08 16:11:14 -0600 | [diff] [blame] | 42 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 43 | +#if HAVE_FSTAB_H |
| 44 | #include <fstab.h> |
| 45 | +#endif |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 46 | #include <glib.h> |
| 47 | #include <stdio.h> |
Andrew Geissler | 72956ed | 2021-01-08 16:11:14 -0600 | [diff] [blame] | 48 | #include <stdlib.h> |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 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 | -- |
| 86 | 2.9.3 |
| 87 | |