Below is the list of changes that have just been committed into a local
5.0 repository of kaa. When kaa does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-10-24 21:16:20+04:00, kaa@polly.(none) +1 -0
Fix for bug #31566: my_write(fd, 0x0, 0, flags) fails with EFAULT on
some platforms
Since the behavior of write(fd, buf, 0) is undefined, it may fail with
EFAULT on some architectures when buf == NULL. The error was propagated
up to a caller, since my_write() code did not handle it properly.
Fixed by checking the 'number of bytes' argument in my_write() and
returning before calling the write() system call when there is nothing
to write.
mysys/my_write.c@stripped, 2007-10-24 21:16:12+04:00, kaa@polly.(none) +4 -0
Return from my_write() before calling the write() system call when the
number of bytes to be written is 0, since the behavior of write() in
this case is not portable.
diff -Nrup a/mysys/my_write.c b/mysys/my_write.c
--- a/mysys/my_write.c 2007-03-28 20:01:08 +04:00
+++ b/mysys/my_write.c 2007-10-24 21:16:12 +04:00
@@ -29,6 +29,10 @@ uint my_write(int Filedes, const byte *B
Filedes, (long) Buffer, Count, MyFlags));
errors=0; written=0L;
+ /* The behavior of write(fd, buf, 0) is not portable */
+ if (unlikely(!Count))
+ return 0;
+
for (;;)
{
if ((writenbytes = (uint) write(Filedes, Buffer, Count)) == Count)
| Thread |
|---|
| • bk commit into 5.0 tree (kaa:1.2535) BUG#31566 | Alexey Kopytov | 24 Oct |