• Marko Mäkelä's avatar
    MDEV-15584: Do not invoke open(dir=NULL) · 1e7ad5bb
    Marko Mäkelä authored
    On Linux, <fcntl.h> declares open(2) as having a nonnull first argument.
    In GCC 8, if a function with nonnull argument is called, that argument
    will be silently assumed to nonnull along the same code path. Hence,
    later nullness checks for this argument can be optimized away.
    
    Similar to MDEV-15587, the fix is to ensure that functions with
    nonnull arguments are not being called with NULL.
    
    This bug caused a crash in mysqlbinlog, which was invoking
    create_temp_file() with the argument dir=NULL. The affected test was
    binlog.binlog_mysqlbinlog_base64. It would display the following message
    before crashing:
    
    mysqlbinlog: O_TMPFILE is not supported on (null) (disabling future attempts)
    Segmentation fault
    1e7ad5bb
mf_tempfile.c 5.38 KB