diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index e57e52103..767ceff06 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,11 @@ +2004-05-03 Corinna Vinschen + + * dir.cc (writable_directory): Remove. + (mkdir): Remove call to writable_directory. + * syscalls.cc (unlink): Ditto. + (rename): Ditto. + * winsup.h (writable_directory): Remove declaration. + 2004-04-30 Corinna Vinschen * fhandler.cc (fhandler_base::open): Call path_conv::get_nt_native_path diff --git a/winsup/cygwin/dir.cc b/winsup/cygwin/dir.cc index 1bb7f0013..d0a650434 100644 --- a/winsup/cygwin/dir.cc +++ b/winsup/cygwin/dir.cc @@ -24,39 +24,6 @@ details. */ #include "dtable.h" #include "cygheap.h" -/* Cygwin internal */ -/* Return whether the directory of a file is writable. Return 1 if it - is. Otherwise, return 0, and set errno appropriately. */ -int __stdcall -writable_directory (const char *file) -{ -#if 0 - char dir[strlen (file) + 1]; - - strcpy (dir, file); - - const char *usedir; - char *slash = strrchr (dir, '\\'); - if (slash == NULL) - usedir = "."; - else if (slash == dir) - { - usedir = "\\"; - } - else - { - *slash = '\0'; - usedir = dir; - } - - int acc = access (usedir, W_OK); - - return acc == 0; -#else - return 1; -#endif -} - extern "C" int dirfd (DIR *dir) { @@ -274,8 +241,6 @@ mkdir (const char *dir, mode_t mode) } nofinalslash (real_dir.get_win32 (), real_dir.get_win32 ()); - if (! writable_directory (real_dir.get_win32 ())) - goto done; if (allow_ntsec && real_dir.has_acls ()) set_security_attribute (S_IFDIR | ((mode & 07777) & ~cygheap->umask), diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index c8f02e0d6..305d0f0f8 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -162,14 +162,6 @@ unlink (const char *ourname) goto done; } - /* Windows won't check the directory mode, so we do that ourselves. */ - if (!writable_directory (win32_name)) - { - syscall_printf ("non-writable directory"); - set_errno (EPERM); - goto done; - } - bool setattrs; if (!((DWORD) win32_name & (FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM))) setattrs = false; @@ -1212,13 +1204,6 @@ rename (const char *oldpath, const char *newpath) return -1; } - if (!writable_directory (real_old) || !writable_directory (real_new)) - { - syscall_printf ("-1 = rename (%s, %s)", oldpath, newpath); - set_errno (EACCES); - return -1; - } - if (!real_old.exists ()) /* file to move doesn't exist */ { syscall_printf ("file to move doesn't exist"); diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h index 233458d2c..4c57c3776 100644 --- a/winsup/cygwin/winsup.h +++ b/winsup/cygwin/winsup.h @@ -240,7 +240,6 @@ extern bool cygwin_finished_initializing; /**************************** Miscellaneous ******************************/ void __stdcall set_std_handle (int); -int __stdcall writable_directory (const char *file); int __stdcall stat_dev (DWORD, int, unsigned long, struct __stat64 *); __ino64_t __stdcall hash_path_name (__ino64_t hash, const char *name) __attribute__ ((regparm(2)));