forked from zssfred/cderpm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcde-2.3.0-ustat.h.patch
104 lines (94 loc) · 2.36 KB
/
cde-2.3.0-ustat.h.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
From dd490b63b1c50b73659f1b5752c25b4c242e249b Mon Sep 17 00:00:00 2001
From: David Cantrell <[email protected]>
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 | 16 +++++++++++++++-
cde/programs/dtfile/dtcopy/sharedFuncs.c | 17 +++++++++++++++--
2 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/cde/programs/dtfile/Trash.c b/cde/programs/dtfile/Trash.c
index d391cccd..61f30fbb 100644
--- a/cde/programs/dtfile/Trash.c
+++ b/cde/programs/dtfile/Trash.c
@@ -106,8 +106,12 @@
#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
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