Skip to content

Conversation

@olebole
Copy link
Member

@olebole olebole commented Nov 12, 2025

These are two commits extracted from NOIRLAB:

  1. dcba136 fixed 'var might be clobbered by longjmp' warning on linux

    I can't reproduce the warning on Linux; however the right solution here would not be declaring a static CHAR *abuf, but instead having a volatile XCHAR *op Therefore, the original commit is replaced with this one.

    Also, as tty_getraw is set in (possibly asynchronuous) signal handlers, it must be declared as static volatile sig_atomic_t tty_getraw.

  2. cd4dc30, bdfd8e7 catch/ignore EBADF when closing fd on background jobs (Mac)

    These commits look overly complicated.

    -       *status = (fclose(kfp->fp) == EOF && kfp->flags&KF_NOSTTY) ? XERR : XOK;
    +        if ((*status = (fclose(kfp->fp) == EOF && kfp->flags&KF_NOSTTY) ?  XERR : XOK) == XERR) {
    +            if (errno == EBADF)
    +                *status = XOK;
    +        }

    Why not just

         *status = (fclose(kfp->fp) == EOF && errno != EBADF && kfp->flags && KF_NOSTTY)? XERR : XOK;

    Also, Just ignoring an error for EBADF seems not thre right solution - why does EBADF appear in background jobs?

Independent of this, there is a use of fcancel(fp), which is similar to what is in zxwhen.c. There, it was replaced in #366 with something more portable; maybe we should re-use it here (moved to osproto.h?).

Pinging @mjfitzpatrick for a potential discussion.

@olebole olebole force-pushed the noirlab-zfiox branch 2 times, most recently from 8484adb to 023f2a1 Compare November 24, 2025 08:13
This fixes the "might be clobbered by longjmp" warning.
Also remove the outdated "register" modifiers in this function.
tty_getraw is set in (possibly asynchronuous) signal handlers, it must
be declared as static volatile sig_atomic_t tty_getraw.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant