MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:kpettersson Date:November 6 2006 10:41am
Subject:bk commit into 4.0 tree (thek:1.2184) BUG#23010
View as plain text  
Below is the list of changes that have just been committed into a local
4.0 repository of thek. When thek 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, 2006-11-06 11:41:52+01:00, thek@stripped +2 -0
  Bug#23010 _my_b_read() passing illegal file handles to my_seek()
  - The io cache flag seek_not_done was not set properly in the 
    reinit_io_cache function call and this led my_seek to be called
    desipite an invalid file handle.
  - Added a test in reinit_io_cache to ensure we have a valid file 
    handle before setting seek_not_done flag.

  mysys/mf_iocache.c@stripped, 2006-11-06 11:41:51+01:00, thek@stripped +5 -1
    Added a test to only trigger my_seek function calls if we have
    a valid file descriptor. 

  mysys/my_seek.c@stripped, 2006-11-06 11:41:51+01:00, thek@stripped +5 -0
    Refactored incomplete condition into an assertion. This also ensures
    that variable newpos is initialized properly.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	thek
# Host:	kpdesk.mysql.com
# Root:	/home/thek/dev/bug23010/my40-bug23010

--- 1.40/mysys/mf_iocache.c	2006-11-06 11:41:54 +01:00
+++ 1.41/mysys/mf_iocache.c	2006-11-06 11:41:54 +01:00
@@ -313,7 +313,11 @@ my_bool reinit_io_cache(IO_CACHE *info, 
       if (info->type == READ_CACHE)
       {
 	info->write_end=info->write_buffer+info->buffer_length;
-	info->seek_not_done=1;
+        /*
+          Trigger a new seek only if we have a valid
+          file handle.
+        */
+        info->seek_not_done= (info->file >= 0);
       }
       info->end_of_file = ~(my_off_t) 0;
     }

--- 1.10/mysys/my_seek.c	2006-11-06 11:41:54 +01:00
+++ 1.11/mysys/my_seek.c	2006-11-06 11:41:54 +01:00
@@ -30,6 +30,11 @@ my_off_t my_seek(File fd, my_off_t pos, 
 		   whence, MyFlags));
   DBUG_ASSERT(pos != MY_FILEPOS_ERROR);		/* safety check */
 
+  /*
+    Make sure we are using a valid file descriptor
+  */
+  DBUG_ASSERT(fd >= 0);
+  
   newpos=lseek(fd, pos, whence);
   if (newpos == (os_off_t) -1)
   {
Thread
bk commit into 4.0 tree (thek:1.2184) BUG#23010kpettersson6 Nov