0001-check-for-fstab.h-during-configure.patch 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. fstab.h is not universally available, checking it during
  6. configure creates a knob to disable fstab reads in the
  7. plugin
  8. Makes it compile/build with musl
  9. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  10. Patch Reworked for xfce4-mount-plugin 0.6.4->1.1.2
  11. Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
  12. ---
  13. configure.ac | 2 +
  14. panel-plugin/devices.c | 22 +++++++++++++++++++---
  15. 2 files changed, 21 insertions(+), 3 deletions(-)
  16. diff --git a/configure.ac b/configure.ac
  17. index 375e64a..590b7ad 100644
  18. --- a/configure.ac
  19. +++ b/configure.ac
  20. @@ -65,6 +65,9 @@ dnl param.h is part of libc6 on Linux, but important for old-style Unix and espe
  21. AC_CHECK_HEADERS([sys/param.h])
  22. AC_CHECK_HEADERS([sys/mount.h])
  23. +dnl make musl happy
  24. +AC_CHECK_HEADERS([fstab.h])
  25. +
  26. 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.
  27. dnl AC_PROG_GCC_TRADITIONAL
  28. diff --git a/panel-plugin/devices.c b/panel-plugin/devices.c
  29. index 797b079..d29df56 100644
  30. --- a/panel-plugin/devices.c
  31. +++ b/panel-plugin/devices.c
  32. @@ -25,7 +25,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  33. #include <config.h>
  34. #endif
  35. +#if HAVE_FSTAB_H
  36. #include <fstab.h>
  37. +#endif
  38. #include <glib.h>
  39. #include <stdio.h>
  40. #include <stdlib.h>
  41. @@ -468,11 +470,12 @@ disks_new (gboolean include_NFSs, gboolean *showed_fstab_dialog, gint length)
  42. {
  43. GPtrArray * pdisks; /* to be returned */
  44. t_disk * pdisk;
  45. - struct fstab *pfstab;
  46. gboolean has_valid_mount_device;
  47. pdisks = g_ptr_array_new();
  48. +#if HAVE_FSTAB_H
  49. + struct fstab *pfstab;
  50. /* open fstab */
  51. if (setfsent()!=1)
  52. {
  53. @@ -526,7 +529,20 @@ disks_new (gboolean include_NFSs, gboolean *showed_fstab_dialog, gint length)
  54. } /* end for */
  55. endfsent(); /* close file */
  56. -
  57. +#else
  58. + /* popup notification dialog */
  59. + if (! (*showed_fstab_dialog) ) {
  60. + xfce_message_dialog (NULL,
  61. + _("Xfce 4 Mount Plugin"),
  62. + "dialog-info",
  63. + _("Your /etc/fstab could not be read because fstab is not supported. This will severely degrade the plugin's abilities."),
  64. + NULL,
  65. + "gtk-ok",
  66. + GTK_RESPONSE_OK,
  67. + NULL);
  68. + *showed_fstab_dialog = TRUE;
  69. + }
  70. +#endif
  71. return pdisks;
  72. }
  73. --
  74. 2.9.3