* EraseDir
* EraseObject
* FileFromTrash
- * FileSysType
* InitializeTrash
* MatchesSacredDirectory
* MessageToFileList
#else
#if defined(__linux__)
#include <sys/vfs.h>
+#include <linux/magic.h>
#else
#include <ustat.h>
#endif
Tt_message msg) ;
static int CheckDeletePermissionRecur(
char *dir);
-static int FileSysType(int dev);
static void RestoreVerifyOk(
Widget w,
XtPointer client_data,
char *parentdir,
char *destinationPath)
{
-#if defined(__FreeBSD__) || defined(__OpenBSD__)
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__linux__)
struct statfs statbuf;
#elif defined(__NetBSD__)
struct statvfs statbuf;
#else
struct stat statbuf;
#endif
- char fname[1024];
+ char fname[PATH_MAX];
-#if defined(__FreeBSD__) || defined(__OpenBSD__)
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__linux__)
if (statfs(parentdir,&statbuf) < 0) /* does not exist */
#elif defined(__NetBSD__)
if (statvfs(parentdir,&statbuf) < 0) /* does not exist */
/* if NFS, need to check if server trusts root */
#if defined(CSRG_BASED)
if (!strcmp(statbuf.f_fstypename, "nfs")) /* Root user and nfs */
+#elif defined(__linux__)
+ if (statbuf.f_type == NFS_SUPER_MAGIC)
#else
- if (FileSysType(statbuf.st_dev) < 0) /* Root user and nfs */
+ /* nothing - always check if root */
#endif
{
int fd = -1;
return -1;
/* copy destinationPath to tmp buffer */
- strcpy(fname, destinationPath);
+ snprintf(fname, PATH_MAX, "%s", destinationPath);
return CheckDeletePermissionRecur(fname);
}
return 0;
}
-#if !defined(CSRG_BASED) && !defined(__linux__)
-static int
-FileSysType(
- int dev)
-{
- struct ustat u1;
- if(ustat(dev,&u1) < 0)
- 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
RestoreObject(
Widget w,
#endif
#if defined(__linux__)
#include <sys/vfs.h>
+#include <linux/magic.h>
#endif
#include <dirent.h>
return ;
} /* end ImageInitialize */
-#if !defined(CSRG_BASED) && !defined(__linux__)
-static int
-CopyFileSysType(
- int dev)
-{
- struct ustat u1;
- if(ustat(dev,&u1) < 0)
- 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
CopyCheckDeletePermissionRecur(
char *destinationPath)
char *parentdir,
char *destinationPath)
{
-#if defined(__FreeBSD__) || defined(__OpenBSD__)
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__linux__)
struct statfs statbuf;
#elif defined(__NetBSD__)
struct statvfs statbuf;
#endif
char fname[PATH_MAX];
-#if defined(__FreeBSD__) || defined(__OpenBSD__)
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__linux__)
if (statfs(parentdir,&statbuf) < 0) /* does not exist */
#elif defined(__NetBSD__)
if (statvfs(parentdir,&statbuf) < 0) /* does not exist */
/* if NFS, need to check if server trusts root */
#if defined(CSRG_BASED)
if (!strcmp(statbuf.f_fstypename, "nfs")) /* Root user and nfs */
+#elif defined(__linux__)
+ if (statbuf.f_type == NFS_SUPER_MAGIC)
#else
- if (CopyFileSysType(statbuf.st_dev) < 0) /* Root user and nfs */
+ /* nothing - always check if root */
#endif
{
char *tmpfile;