Patch out use of deprecated and now removed ustat(2) function on Linux.
authorDavid Cantrell <david.l.cantrell@gmail.com>
Tue, 21 Aug 2018 19:41:48 +0000 (15:41 -0400)
committerJon Trulson <jon@radscan.com>
Sat, 25 Aug 2018 23:10:02 +0000 (17:10 -0600)
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
cde/programs/dtfile/dtcopy/sharedFuncs.c

index d391cccdb0e5ffdbcc9e2806b017dd34619b3228..61f30fbb275c554b013cc9ff4d3244e6d046495a 100644 (file)
 #include <sys/param.h>
 #include <sys/mount.h>
 #else
+#if defined(__linux__)
+#include <sys/vfs.h>
+#else
 #include <ustat.h>
 #endif
+#endif
 
 #include <Xm/RowColumn.h>
 #include <Xm/CascadeB.h>
@@ -4264,7 +4268,7 @@ CheckDeletePermissionRecur(
   return 0;
 }
 
-#if !defined(CSRG_BASED)
+#if !defined(CSRG_BASED) && !defined(__linux__)
 static int
 FileSysType(
    int dev)
@@ -4274,6 +4278,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
index b3a0e9518b615b4e4e3c4c660940843bae71ceef..31b1ca51bdf4bdc85c321047af90c3ab45059789 100644 (file)
 #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