This is now a compile time failure on systems with glibc-2.28 as they
have removed ustat(2) from the library.  The replacement for a while has
been statfs(2), so this patch does that for dtfile which is the only
program I found that uses that.

Also, this patch could be refactored or just have a different style.
Not sure what the project is aiming for here, but let me know if you
want things altered.

Thanks,

-- 
David Cantrell <dcantr...@redhat.com>
Red Hat, Inc. | Boston, MA | EST5EDT
From 86c5a1863a940be93168c87f37bfaf4086425412 Mon Sep 17 00:00:00 2001
From: David Cantrell <david.l.cantr...@gmail.com>
Date: Tue, 21 Aug 2018 15:41:48 -0400
Subject: [PATCH] Patch out use of deprecated and now removed ustat(2) function
 on Linux.

dtfile makes use of ustat(2) on certain systems.  This call has been
deprecated in glibc for a while and now, as of glibc-2.28, it has been
removed.  The recommended replacement is to use statfs(2).
---
 cde/programs/dtfile/Trash.c              | 14 +++++++++++++-
 cde/programs/dtfile/dtcopy/sharedFuncs.c | 17 +++++++++++++++--
 2 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/cde/programs/dtfile/Trash.c b/cde/programs/dtfile/Trash.c
index d391cccd..a9176732 100644
--- a/cde/programs/dtfile/Trash.c
+++ b/cde/programs/dtfile/Trash.c
@@ -106,8 +106,10 @@
 #include <sys/param.h>
 #include <sys/mount.h>
 #else
+#if !defined(__linux__)
 #include <ustat.h>
 #endif
+#endif
 
 #include <Xm/RowColumn.h>
 #include <Xm/CascadeB.h>
@@ -4264,7 +4266,7 @@ CheckDeletePermissionRecur(
   return 0;
 }
 
-#if !defined(CSRG_BASED)
+#if !defined(CSRG_BASED) && !defined(__linux__)
 static int
 FileSysType(
    int dev)
@@ -4274,6 +4276,16 @@ FileSysType(
      return -2;
   return u1.f_tinode;
 }
+#else
+static int
+FileSysType(
+   int dev)
+{
+  struct statfs u1;
+  if(statfs(dev,&u1) < 0)
+     return -2;
+  return u1.f_ffree;
+}
 #endif
 
 static int
diff --git a/cde/programs/dtfile/dtcopy/sharedFuncs.c b/cde/programs/dtfile/dtcopy/sharedFuncs.c
index b3a0e951..31b1ca51 100644
--- a/cde/programs/dtfile/dtcopy/sharedFuncs.c
+++ b/cde/programs/dtfile/dtcopy/sharedFuncs.c
@@ -63,9 +63,12 @@
 #include <sys/mount.h>
 #include <pwd.h>
 #include <fcntl.h>
-#if !defined(CSRG_BASED)
+#if !defined(CSRG_BASED) && !defined(__linux__)
 #include <ustat.h>
 #endif
+#if defined(__linux__)
+#include <sys/vfs.h>
+#endif
 #include <dirent.h>
 
 
@@ -358,7 +361,7 @@ ImageInitialize( Display *display )
     return ;
 }  /*  end ImageInitialize */
 
-#if !defined(CSRG_BASED)
+#if !defined(CSRG_BASED) && !defined(__linux__)
 static int
 CopyFileSysType(
    int dev)
@@ -368,6 +371,16 @@ CopyFileSysType(
      return -2;
   return u1.f_tinode;
 }
+#else
+static int
+CopyFileSysType(
+   int dev)
+{
+  struct statfs u1;
+  if(statfs(dev,&u1) < 0)
+     return -2;
+  return u1.f_ffree;
+}
 #endif
 
 static int
-- 
2.17.1

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
cdesktopenv-devel mailing list
cdesktopenv-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdesktopenv-devel

Reply via email to