/*
- * $Id: unix.c,v 1.43 2003-03-09 19:55:35 didg Exp $
+ * $Id: unix.c,v 1.43.2.1 2003-07-21 05:50:54 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
#include <limits.h>
#include <atalk/adouble.h>
#include <atalk/afp.h>
-
/* STDC check */
-#if STDC_HEADERS
+#ifdef STDC_HEADERS
#include <string.h>
#else /* STDC_HEADERS */
#ifndef HAVE_STRCHR
#include "directory.h"
#include "volume.h"
#include "unix.h"
+#include "fork.h"
/*
* Get the free space on a partition.
mbits = 0;
- mbits |= ( bits & ( S_IREAD >> 6 )) ? (AR_UREAD | AR_USEARCH) : 0;
+ mbits |= ( bits & ( S_IREAD >> 6 )) ? AR_UREAD : 0;
mbits |= ( bits & ( S_IWRITE >> 6 )) ? AR_UWRITE : 0;
- /* Do we really need this?
- mbits |= ( bits & ( S_IEXEC >> 6) ) ? AR_USEARCH : 0; */
+ /* Do we really need this? */
+ mbits |= ( bits & ( S_IEXEC >> 6) ) ? AR_USEARCH : 0;
return( mbits );
}
return( 0 );
}
+/* --------------------- */
+int setfilemode (path, mode)
+struct path* path;
+mode_t mode;
+{
+ if (!path->st_valid) {
+ of_stat(path);
+ }
+
+ if (path->st_errno) {
+ return -1;
+ }
+
+ if (setfilmode( path->u_name, mode, &path->st) < 0)
+ return -1;
+ /* we need to set write perm if read set for resource fork */
+ return setfilmode(ad_path( path->u_name, ADFLAGS_HF ), ad_hf_mode(mode), &path->st);
+}
+
+/* --------------------- */
int setfilmode(name, mode, st)
char * name;
mode_t mode;
return 0;
}
+/* --------------------- */
+int setdirunixmode( mode, noadouble, dropbox )
+const mode_t mode;
+const int noadouble;
+const int dropbox;
+{
+ if ( stickydirmode(".AppleDouble", DIRBITS | mode, dropbox) < 0 && !noadouble)
+ return -1 ;
+
+ if ( stickydirmode(".", DIRBITS | mode, dropbox) < 0 )
+ return -1;
+ return 0;
+}
+
+/* --------------------- */
int setdirmode( mode, noadouble, dropbox )
const mode_t mode;
const int noadouble;
/* This is equivalent of unix rename(). */
int unix_rename(const char *oldpath, const char *newpath)
{
+#if 0
char pd_name[PATH_MAX+1];
int i;
struct stat pd_stat;
uid_t uid;
+#endif
if (rename(oldpath, newpath) < 0)
return -1;