From 9cb1f309f2b86542338e37c424837c6031bc2d7b Mon Sep 17 00:00:00 2001 From: David Cantrell 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 #include #else +#if defined(__linux__) +#include +#else #include #endif +#endif #include #include @@ -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 #include #include -#if !defined(CSRG_BASED) +#if !defined(CSRG_BASED) && !defined(__linux__) #include #endif +#if defined(__linux__) +#include +#endif #include @@ -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.25.1