Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2001-07-13 21:22:15 +0400
committerChristopher Faylor <me@cgf.cx>2001-07-13 21:22:15 +0400
commit2aa2adb2d27e9323d739321acff1aba46cbab7e0 (patch)
treec8c741b19a5d0aab29864dc91b71ac4e96f0605d
parent0b4bfdd527057200c294e6f62ad1552d981c13dd (diff)
* syscalls.cc (_unlink): Correct (?) logic which determines when to report an
access violation and when to queue file for eventual deletion. (stat_worker): Check for invalid buf argument.
-rw-r--r--winsup/cygwin/ChangeLog11
-rw-r--r--winsup/cygwin/syscalls.cc31
2 files changed, 26 insertions, 16 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 2f4bf3c23..c8fa9689b 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,10 @@
+Fri Jul 13 13:13:09 2001 Christopher Faylor <cgf@cygnus.com>
+
+ * syscalls.cc (_unlink): Correct (?) logic which determines when
+ to report an access violation and when to queue file for eventual
+ deletion.
+ (stat_worker): Check for invalid buf argument.
+
Tue Jul 10 23:01:00 2001 Corinna Vinschen <corinna@vinschen.de>
* mmap.cc (fhandler_disk_file::mmap): Try to open file mappings
@@ -23,8 +30,8 @@ Wed Jun 27 22:19:07 2001 Christopher Faylor <cgf@cygnus.com>
retrieving info about remote shares can take some time.
Wed Jun 27 23:30:00 2001 Robert Collins <rbtcollins@hotmail.com>
- Christopher Faylor <cgf@cygnus.com>
-
+ Christopher Faylor <cgf@cygnus.com>
+
Change check_null_empty_path* to check_null_empty_str* throughout.
* path.h (check_null_empty_str_errno): Convert to a function prototype.
* path.cc (check_null_empty_str): Move to miscfuncs.cc.
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 7fc972e6c..d76c2cf1a 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -124,6 +124,13 @@ _unlink (const char *ourname)
(void) chmod (win32_name, 0777);
}
+ /* Windows 9x seems to report ERROR_ACCESS_DENIED rather than sharing
+ violation. So, set lasterr to ERROR_SHARING_VIOLATION in this case
+ to simplify tests. */
+ if (os_being_run != winNT && lasterr == ERROR_ACCESS_DENIED
+ && !win32_name.isremote ())
+ lasterr = ERROR_SHARING_VIOLATION;
+
/* Tried to delete file by normal DeleteFile and by resetting protection
and then deleting. That didn't work.
@@ -161,22 +168,12 @@ _unlink (const char *ourname)
deleted by the OS. */
}
- /* FILE_FLAGS_DELETE_ON_CLOSE was a bust. If delete_on_close_ok is
- true then it should have worked. If it didn't work, that was an
- error. Windows 9x seems to return ERROR_ACCESS_DENIED in "sharing
- violation" type of situations. */
- if (delete_on_close_ok
- || (lasterr != ERROR_ACCESS_DENIED && lasterr != ERROR_SHARING_VIOLATION))
+ /* FILE_FLAGS_DELETE_ON_CLOSE was a bust. If this is a sharing
+ violation, then queue the file for deletion when the process
+ exits. Otherwise, punt. */
+ if (lasterr != ERROR_SHARING_VIOLATION)
goto err;
- /* Can't reliably detect sharing violations on remote shares, so if we
- didn't specifically get that error, then punt. */
- if (lasterr != ERROR_SHARING_VIOLATION && win32_name.isremote ())
- {
- syscall_printf ("access denied on remote drive");
- goto err; /* Can't detect this, unfortunately */
- }
-
syscall_printf ("couldn't delete file, err %d", lasterr);
/* Add file to the "to be deleted" queue. */
@@ -1035,6 +1032,7 @@ stat_worker (const char *caller, const char *name, struct stat *buf,
int attribute = 0;
uid_t uid;
gid_t gid;
+ int err;
UINT dtype;
fhandler_disk_file fh (NULL);
@@ -1052,6 +1050,11 @@ stat_worker (const char *caller, const char *name, struct stat *buf,
goto done;
}
+ if ((err = check_null_invalid_struct_errno (buf)))
+ {
+ set_errno (err);
+ goto done;
+ }
memset (buf, 0, sizeof (struct stat));
if (real_path.is_device ())