• unknown's avatar
    Fix for bug #31566: my_write(fd, 0x0, 0, flags) fails with EFAULT on · b260e144
    unknown authored
    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.
    b260e144
my_write.c 2.95 KB