Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-68472

sigchld_handler() doesn't restore errno

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.11.1
    • 5.11.0
    • Core: I/O
    • None
    • 28ab81158feced7122b1655cbe1418343fe5db68

    Description

      In qtbase/src/3rdparty/forkfd/forkfd.c a signal handler is registered for SIGCHLD. In a comment in the signal handler function there's a link to a web page (http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_04_03) giving some guidance on what can be done in signal handlers.

      The page gives this advise:

      "Operations which obtain the value of errno and operations which assign a value to errno shall be async-signal-safe, provided that the signal-catching function saves the value of errno upon entry and restores it before it returns."

      sigchld_handler() in forkfd.c doesn't follow this. For example it calls waitid(), but doesn't save or restore errno in any way.

      Attachments

        Activity

          People

            thiago Thiago Macieira
            khuttun Kalle Huttunen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: