Fixes for dtfile on OpenBSD, plus missing prototypes. Use statfs() on BSD to find out if a file system is NFS.
This commit is contained in:
committed by
Jon Trulson
parent
57463ec10e
commit
eaec696ad6
@@ -69,7 +69,7 @@
|
||||
# define ROOTINO UFSROOTINO
|
||||
#endif
|
||||
|
||||
#if defined(linux)
|
||||
#if defined(linux) || defined(CSRG_BASED)
|
||||
# include <sys/param.h>
|
||||
# define ROOTINO 2
|
||||
#endif
|
||||
@@ -80,9 +80,12 @@
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/mount.h>
|
||||
#include <pwd.h>
|
||||
#include <fcntl.h>
|
||||
#if !defined(CSRG_BASED)
|
||||
#include <ustat.h>
|
||||
#endif
|
||||
#include <dirent.h>
|
||||
|
||||
|
||||
@@ -373,6 +376,7 @@ ImageInitialize( Display *display )
|
||||
return ;
|
||||
} /* end ImageInitialize */
|
||||
|
||||
#if !defined(CSRG_BASED)
|
||||
static int
|
||||
CopyFileSysType(
|
||||
int dev)
|
||||
@@ -382,6 +386,7 @@ CopyFileSysType(
|
||||
return -2;
|
||||
return u1.f_tinode;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
CopyCheckDeletePermissionRecur(
|
||||
@@ -446,17 +451,29 @@ CopyCheckDeletePermission(
|
||||
char *parentdir,
|
||||
char *destinationPath)
|
||||
{
|
||||
#if defined(CSRG_BASED)
|
||||
struct statfs statbuf;
|
||||
#else
|
||||
struct stat statbuf;
|
||||
#endif
|
||||
char fname[1024];
|
||||
|
||||
#if defined(CSRG_BASED)
|
||||
if (statfs(parentdir,&statbuf) < 0) /* does not exist */
|
||||
#else
|
||||
if (lstat(parentdir,&statbuf) < 0) /* does not exist */
|
||||
#endif
|
||||
return -1;
|
||||
|
||||
/* check if we are root */
|
||||
if (getuid() == 0)
|
||||
{
|
||||
/* if NFS, need to check if server trusts root */
|
||||
#if defined(CSRG_BASED)
|
||||
if (!strcmp(statbuf.f_fstypename, "nfs")) /* Root user and nfs */
|
||||
#else
|
||||
if (CopyFileSysType(statbuf.st_dev) < 0) /* Root user and nfs */
|
||||
#endif
|
||||
{
|
||||
char *tmpfile;
|
||||
tmpfile = tempnam(parentdir,"quang");
|
||||
|
||||
Reference in New Issue
Block a user