Skip to content
  • Dyre Tjeldvoll's avatar
    78c9261e
    Bug#26447825: MYSQLD COMPLETELY SILENT EVEN IN FAILURE IF LOG-ERROR IS · 78c9261e
    Dyre Tjeldvoll authored
    NOT WRITABLE
    
    Problem: C-library function freopen() is not atomic. It closes the
    stream given as argument before trying (and thereby checking if it is
    possible) to open the file which the stream is to be associated with. So
    in the event that the open() fails, the user is left without a working
    stream where the error message for the failed open can go. Likewise, any
    buffered messages not yet written to the stream are also lost.
    
    Solution: Stop using freopen() and re-implement my_freopen() using
    fopen(), fileno() and dup2(). That way any error from open() (or
    fileno()) is caught before doing anything which affects the stream.
    According to the man-page, dup2() is atomic.
    78c9261e
    Bug#26447825: MYSQLD COMPLETELY SILENT EVEN IN FAILURE IF LOG-ERROR IS
    Dyre Tjeldvoll authored
    NOT WRITABLE
    
    Problem: C-library function freopen() is not atomic. It closes the
    stream given as argument before trying (and thereby checking if it is
    possible) to open the file which the stream is to be associated with. So
    in the event that the open() fails, the user is left without a working
    stream where the error message for the failed open can go. Likewise, any
    buffered messages not yet written to the stream are also lost.
    
    Solution: Stop using freopen() and re-implement my_freopen() using
    fopen(), fileno() and dup2(). That way any error from open() (or
    fileno()) is caught before doing anything which affects the stream.
    According to the man-page, dup2() is atomic.
Loading