• Rohit Kalhans's avatar
    BUG#11757312: MYSQLBINLOG DOES NOT ACCEPT INPUT FROM STDIN · ff04c5bd
    Rohit Kalhans authored
    WHEN STDIN IS A PIPE
                
    Problem: Mysqlbinlog does not accept the input from STDIN when 
    STDIN is a pipe. This prevents the users from passing the input file
    through a shell pipe.    
    
    Background: The my_seek() function does not check if the file descriptor
    passed to it is regular (seekable) file. The check_header() function in
    mysqlbinlog calls the my_b_seek() unconditionally and it fails when
    the underlying file is a PIPE.  
                
    Resolution: We resolve this problem by checking if the underlying file
    is a regular file by using my_fstat() before calling my_b_seek(). 
    If the underlying file is not seekable we skip the call to my_b_seek()
    in check_header().
    
    client/mysqlbinlog.cc:
      Added a check to avoid the my_b_seek() call if the
      underlying file is a PIPE.
    ff04c5bd
mysqlbinlog.cc 69.8 KB