From 8933fb3abd0395b63f3b424a8fa4cfee8ecee9d2 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 18 Oct 2007 21:48:16 +0200 Subject: [PATCH 1/2] Remove unportable use of "system rm" --- mysql-test/t/binlog_killed.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/t/binlog_killed.test b/mysql-test/t/binlog_killed.test index 034895f17cb..e0b2f0a3db6 100644 --- a/mysql-test/t/binlog_killed.test +++ b/mysql-test/t/binlog_killed.test @@ -242,7 +242,7 @@ drop function bug27563; drop function bug27565; } -system rm $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog ; +remove_file $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog ; drop table t1,t2,t3; From b260e144a591706141b48e49fd1b6a5c302a20f0 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 24 Oct 2007 21:16:20 +0400 Subject: [PATCH 2/2] 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: 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. --- mysys/my_write.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mysys/my_write.c b/mysys/my_write.c index 4c3d187e4e8..08d70accd57 100644 --- a/mysys/my_write.c +++ b/mysys/my_write.c @@ -29,6 +29,10 @@ uint my_write(int Filedes, const byte *Buffer, uint Count, myf MyFlags) 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)