Mail Archives: cygwin-developers/1999/08/13/18:26:58
This is a multi-part message in MIME format.
--------------135B1228C4B1FF425F549C08
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi!
I have found two errors in fhandler code:
- In case of an error fhandler_base::raw_read always returns the error
code EACCES.
- fhandler_base::raw_write always returns bytes_written if the windows
error is ERROR_DISK_FULL. This results in an endless loop e.g. in
cp command if bytes_written is 0.
While changing the above behaviour I found that ERROR_DISK_FULL is
not handled by errno.cc.
Regards,
Corinna
ChangeLog:
==========
Sat Aug 14 0:10:00 Corinna Vinschen <corinna AT vinschen DOT de>
* fhandler.cc (fhandler_base::raw_read): `set_errno (EACCES)'
replaced with `__seterrno_from_win_error (errcode)'.
(fhandler_base::raw_write): In case of ERROR_DISK_FULL, return
bytes_written only if bytes_written > 0.
* errno.cc: Map ERROR_DISK_FULL to ENOSPC.
--------------135B1228C4B1FF425F549C08
Content-Type: text/plain; charset=us-ascii;
name="rw-patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="rw-patch"
Index: errno.cc
===================================================================
RCS file: /src/cvsroot/winsup-990808/errno.cc,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 errno.cc
--- errno.cc 1999/08/09 10:50:55 1.1.1.1
+++ errno.cc 1999/08/13 22:05:10
@@ -102,6 +102,7 @@ errmap[] =
X (CRC, EIO),
X (NEGATIVE_SEEK, EINVAL),
X (NOT_READY, ENOMEDIUM),
+ X (DISK_FULL, ENOSPC),
{ 0, NULL, 0}
};
Index: fhandler.cc
===================================================================
RCS file: /src/cvsroot/winsup-990808/fhandler.cc,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 fhandler.cc
--- fhandler.cc 1999/08/09 10:50:55 1.1.1.1
+++ fhandler.cc 1999/08/13 22:09:15
@@ -218,7 +218,7 @@ fhandler_base::raw_read (void *ptr, size
break;
default:
syscall_printf ("ReadFile %s failed, %E", unix_path_name_);
- set_errno (EACCES);
+ __seterrno_from_win_error (errcode);
return -1;
break;
}
@@ -267,7 +267,8 @@ fhandler_base::raw_write (const void *pt
if (!WriteFile (get_handle(), ptr, len, &bytes_written, 0))
{
- if (GetLastError () == ERROR_DISK_FULL)
+ if (GetLastError () == ERROR_DISK_FULL
+ && bytes_written > 0)
return bytes_written;
__seterrno ();
if (get_errno () == EPIPE)
--------------135B1228C4B1FF425F549C08--
- Raw text -