* dir.cc (writable_directory): Remove.
(mkdir): Remove call to writable_directory. * syscalls.cc (unlink): Ditto. (rename): Ditto. * winsup.h (writable_directory): Remove declaration.
This commit is contained in:
parent
2d465f741f
commit
1e98729b2a
@ -1,3 +1,11 @@
|
|||||||
|
2004-05-03 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* 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 <corinna@vinschen.de>
|
2004-04-30 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* fhandler.cc (fhandler_base::open): Call path_conv::get_nt_native_path
|
* fhandler.cc (fhandler_base::open): Call path_conv::get_nt_native_path
|
||||||
|
@ -24,39 +24,6 @@ details. */
|
|||||||
#include "dtable.h"
|
#include "dtable.h"
|
||||||
#include "cygheap.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
|
extern "C" int
|
||||||
dirfd (DIR *dir)
|
dirfd (DIR *dir)
|
||||||
{
|
{
|
||||||
@ -274,8 +241,6 @@ mkdir (const char *dir, mode_t mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
nofinalslash (real_dir.get_win32 (), real_dir.get_win32 ());
|
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 ())
|
if (allow_ntsec && real_dir.has_acls ())
|
||||||
set_security_attribute (S_IFDIR | ((mode & 07777) & ~cygheap->umask),
|
set_security_attribute (S_IFDIR | ((mode & 07777) & ~cygheap->umask),
|
||||||
|
@ -162,14 +162,6 @@ unlink (const char *ourname)
|
|||||||
goto done;
|
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;
|
bool setattrs;
|
||||||
if (!((DWORD) win32_name & (FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM)))
|
if (!((DWORD) win32_name & (FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM)))
|
||||||
setattrs = false;
|
setattrs = false;
|
||||||
@ -1212,13 +1204,6 @@ rename (const char *oldpath, const char *newpath)
|
|||||||
return -1;
|
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 */
|
if (!real_old.exists ()) /* file to move doesn't exist */
|
||||||
{
|
{
|
||||||
syscall_printf ("file to move doesn't exist");
|
syscall_printf ("file to move doesn't exist");
|
||||||
|
@ -240,7 +240,6 @@ extern bool cygwin_finished_initializing;
|
|||||||
/**************************** Miscellaneous ******************************/
|
/**************************** Miscellaneous ******************************/
|
||||||
|
|
||||||
void __stdcall set_std_handle (int);
|
void __stdcall set_std_handle (int);
|
||||||
int __stdcall writable_directory (const char *file);
|
|
||||||
int __stdcall stat_dev (DWORD, int, unsigned long, struct __stat64 *);
|
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)));
|
__ino64_t __stdcall hash_path_name (__ino64_t hash, const char *name) __attribute__ ((regparm(2)));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user