Skip to content
  • Daniel Stone's avatar
    wet_process: Do not weston_log() after fork() · 53f895b4
    Daniel Stone authored and Pekka Paalanen's avatar Pekka Paalanen committed
    
    
    [common equivalent of 77cf8cb0 in Xwayland from Pekka Paalanen; its
     commit message follows]
    
    Between fork() and exec() in the child process it is only safe to use
    async-signal-safe functions. weston_log() definitely is not one, it
    allocates memory and does whatnot.
    
    weston_log() is also inappropriate for other reasons: the child process
    has its own stream buffers and flight-recorder. No-one looks into the
    child process' flight recorder, so messages would be lost there. The
    logging machinery might also attempt to write into debug streams,
    meaning both parent and child could be writing simultaneously.
    
    It seems that the best we can do is to pre-bake an error message and
    only write() it out if exec() fails. There is no mention that even
    strerror_r() might be safe to call, so we don't.
    
    Signed-off-by: default avatarDaniel Stone <daniels@collabora.com>
    53f895b4
Loading