1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

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:
Pascal Stumpf 2012-08-10 15:09:04 +02:00 committed by Jon Trulson
parent 57463ec10e
commit eaec696ad6
10 changed files with 54 additions and 10 deletions

View file

@ -105,6 +105,7 @@
#include <Xm/PushBG.h> #include <Xm/PushBG.h>
#include <Xm/RowColumn.h> #include <Xm/RowColumn.h>
#include <Xm/CascadeBG.h> #include <Xm/CascadeBG.h>
#include <Xm/LabelG.h>
#include <Xm/SeparatoG.h> #include <Xm/SeparatoG.h>
#include <Xm/VirtKeys.h> #include <Xm/VirtKeys.h>

View file

@ -64,7 +64,7 @@
# define ROOTINO UFSROOTINO # define ROOTINO UFSROOTINO
# endif /* sco */ # endif /* sco */
#else #else
# if defined(linux) # if defined(linux) || defined(CSRG_BASED)
# define ROOTINO 2 # define ROOTINO 2
# endif # endif
# include <sys/param.h> # include <sys/param.h>
@ -994,7 +994,8 @@ FileManip(
if (lstat (to, &s2) >= 0) /* <to> exists */ if (lstat (to, &s2) >= 0) /* <to> exists */
{ {
if ((stat (to, &s3) >= 0) && if ((stat (to, &s3) >= 0) &&
#if defined(__hp_osf) || (__ultrix) || defined(__osf__) || defined(linux) #if defined(__hp_osf) || (__ultrix) || defined(__osf__) || defined(linux) || \
defined(CSRG_BASED)
(((s3.st_mode & S_IFMT) == S_IFDIR) /* if is a directory */ (((s3.st_mode & S_IFMT) == S_IFDIR) /* if is a directory */
|| ((s3.st_mode & S_IFMT) == S_IFSOCK)) ) /* or a net special */ || ((s3.st_mode & S_IFMT) == S_IFSOCK)) ) /* or a net special */
#else #else

View file

@ -106,6 +106,7 @@
#include "Filter.h" #include "Filter.h"
#include "Help.h" #include "Help.h"
char **DtDtsDataTypeNames(void);
static char * FILE_FILTER = "FileFilter"; static char * FILE_FILTER = "FileFilter";

View file

@ -1811,7 +1811,7 @@ ExecuteFind(
if (access_priv == -1 && geteuid() != root_user) if (access_priv == -1 && geteuid() != root_user)
{ {
#else #else
# if defined(__hp_osf) || defined(__ultrix) || defined(__osf__) || defined(linux) # if defined(__hp_osf) || defined(__ultrix) || defined(__osf__) || defined(linux) || defined(CSRG_BASED)
setreuid(geteuid(),-1); setreuid(geteuid(),-1);
if (access ((char *) path, R_OK) == -1) if (access ((char *) path, R_OK) == -1)
{ {
@ -1908,10 +1908,10 @@ ExecuteFind(
#ifdef __osf__ #ifdef __osf__
oldSig = signal(SIGCHLD, sigchld_handler); oldSig = signal(SIGCHLD, sigchld_handler);
#else #else
oldSig = signal(SIGCLD, SIG_DFL); oldSig = signal(SIGCHLD, SIG_DFL);
#endif /* __osf__ */ #endif /* __osf__ */
find_rec->popenId = findpopen(command, "r",&(find_rec->childpid)); find_rec->popenId = findpopen(command, "r",&(find_rec->childpid));
signal (SIGCLD, oldSig); signal (SIGCHLD, oldSig);
if (find_rec->popenId == NULL) if (find_rec->popenId == NULL)
{ {

View file

@ -1020,7 +1020,7 @@ main(
/* error handling follows, none for now */ /* error handling follows, none for now */
; ;
#else #else
(void) signal (SIGCLD, SIG_IGN); (void) signal (SIGCHLD, SIG_IGN);
#endif /* __osf__ */ #endif /* __osf__ */
XtSetLanguageProc( NULL, NULL, NULL ); XtSetLanguageProc( NULL, NULL, NULL );

View file

@ -107,13 +107,13 @@ RunFileCommand(
/* prepare to catch the command termination */ /* prepare to catch the command termination */
oldSig = signal (SIGCLD, SIG_DFL); oldSig = signal (SIGCHLD, SIG_DFL);
/* fork a process to run command */ /* fork a process to run command */
if ((child = fork ()) < 0) /* fork failed */ if ((child = fork ()) < 0) /* fork failed */
{ {
(void) signal (SIGCLD, oldSig); (void) signal (SIGCHLD, oldSig);
return (-1); return (-1);
} }
@ -126,7 +126,7 @@ RunFileCommand(
wait_return = wait (&exit_value); wait_return = wait (&exit_value);
} while (wait_return != child); } while (wait_return != child);
(void) signal (SIGCLD, oldSig); /* child stopped or terminated */ (void) signal (SIGCHLD, oldSig); /* child stopped or terminated */
return (exit_value); /* if exit_value == 0 then success */ return (exit_value); /* if exit_value == 0 then success */
} }

View file

@ -130,6 +130,8 @@ extern XmWidgetExtData _XmGetWidgetExtData(
#include "Main.h" #include "Main.h"
#include "SharedProcs.h" #include "SharedProcs.h"
extern char *pathcollapse();
/* Defines */ /* Defines */
#define RW_ALL S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH #define RW_ALL S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH

View file

@ -50,6 +50,9 @@
/******** Public Function Declarations ********/ /******** Public Function Declarations ********/
extern String _DtStripSpaces(
String string) ;
extern char * _DtPName( extern char * _DtPName(
register char *name) ; register char *name) ;
extern char * _DtFollowLink( extern char * _DtFollowLink(

View file

@ -101,7 +101,12 @@
#include <dirent.h> #include <dirent.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#if defined(CSRG_BASED)
#include <sys/param.h>
#include <sys/mount.h>
#else
#include <ustat.h> #include <ustat.h>
#endif
#include <Xm/RowColumn.h> #include <Xm/RowColumn.h>
#include <Xm/CascadeB.h> #include <Xm/CascadeB.h>
@ -4106,17 +4111,29 @@ CheckDeletePermission(
char *parentdir, char *parentdir,
char *destinationPath) char *destinationPath)
{ {
#if defined(CSRG_BASED)
struct statfs statbuf;
#else
struct stat statbuf; struct stat statbuf;
#endif
char fname[1024]; char fname[1024];
#if defined(CSRG_BASED)
if (statfs(parentdir,&statbuf) < 0) /* does not exist */
#else
if (lstat(parentdir,&statbuf) < 0) /* does not exist */ if (lstat(parentdir,&statbuf) < 0) /* does not exist */
#endif
return -1; return -1;
/* check if we are root */ /* check if we are root */
if (getuid() == 0) if (getuid() == 0)
{ {
/* if NFS, need to check if server trusts root */ /* 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 (FileSysType(statbuf.st_dev) < 0) /* Root user and nfs */ if (FileSysType(statbuf.st_dev) < 0) /* Root user and nfs */
#endif
{ {
char *tmpfile; char *tmpfile;
tmpfile = tempnam(parentdir,"quang"); tmpfile = tempnam(parentdir,"quang");
@ -4195,6 +4212,7 @@ CheckDeletePermissionRecur(
return 0; return 0;
} }
#if !defined(CSRG_BASED)
static int static int
FileSysType( FileSysType(
int dev) int dev)
@ -4204,6 +4222,7 @@ FileSysType(
return -2; return -2;
return u1.f_tinode; return u1.f_tinode;
} }
#endif
static int static int
RestoreObject( RestoreObject(

View file

@ -69,7 +69,7 @@
# define ROOTINO UFSROOTINO # define ROOTINO UFSROOTINO
#endif #endif
#if defined(linux) #if defined(linux) || defined(CSRG_BASED)
# include <sys/param.h> # include <sys/param.h>
# define ROOTINO 2 # define ROOTINO 2
#endif #endif
@ -80,9 +80,12 @@
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/mount.h>
#include <pwd.h> #include <pwd.h>
#include <fcntl.h> #include <fcntl.h>
#if !defined(CSRG_BASED)
#include <ustat.h> #include <ustat.h>
#endif
#include <dirent.h> #include <dirent.h>
@ -373,6 +376,7 @@ ImageInitialize( Display *display )
return ; return ;
} /* end ImageInitialize */ } /* end ImageInitialize */
#if !defined(CSRG_BASED)
static int static int
CopyFileSysType( CopyFileSysType(
int dev) int dev)
@ -382,6 +386,7 @@ CopyFileSysType(
return -2; return -2;
return u1.f_tinode; return u1.f_tinode;
} }
#endif
static int static int
CopyCheckDeletePermissionRecur( CopyCheckDeletePermissionRecur(
@ -446,17 +451,29 @@ CopyCheckDeletePermission(
char *parentdir, char *parentdir,
char *destinationPath) char *destinationPath)
{ {
#if defined(CSRG_BASED)
struct statfs statbuf;
#else
struct stat statbuf; struct stat statbuf;
#endif
char fname[1024]; char fname[1024];
#if defined(CSRG_BASED)
if (statfs(parentdir,&statbuf) < 0) /* does not exist */
#else
if (lstat(parentdir,&statbuf) < 0) /* does not exist */ if (lstat(parentdir,&statbuf) < 0) /* does not exist */
#endif
return -1; return -1;
/* check if we are root */ /* check if we are root */
if (getuid() == 0) if (getuid() == 0)
{ {
/* if NFS, need to check if server trusts root */ /* 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 */ if (CopyFileSysType(statbuf.st_dev) < 0) /* Root user and nfs */
#endif
{ {
char *tmpfile; char *tmpfile;
tmpfile = tempnam(parentdir,"quang"); tmpfile = tempnam(parentdir,"quang");