help / color / mirror / code / Atom feed
From: Stephane Chazelas <stephane@chazelas.org>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Daniel Shahaf <d.s@daniel.shahaf.name>, zsh-workers@zsh.org
Subject: Re: xtrace output sets ERRNO to 9 (EBADF)
Date: Sun, 11 Dec 2022 20:01:33 +0000	[thread overview]
Message-ID: <20221211200133.v5ih3ss2hx24lp4x@chazelas.org> (raw)
In-Reply-To: <CAH+w=7ZKMq+2XGe=taPjVevkU7b34=RXr3rsV8xssLoRRRq5oA@mail.gmail.com>

2022-12-11 10:52:44 -0800, Bart Schaefer:
> In any case,
> fileno() doesn't set errno (it's just a data structure deref, would
> only fail by crashing)

Not that it matters much here, but POSIX does say that fileno()
shall  return -1 EBADF if "The stream is not associated with a
file." and may if "The file descriptor underlying stream is not
a valid file descriptor."


musl libc has:

int fileno(FILE *f)
        int fd = f->fd;
        if (fd < 0) {
                errno = EBADF;
                return -1;
        return fd;


      reply	other threads:[~2022-12-11 20:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-09 14:10 Stephane Chazelas
2022-12-10  2:57 ` Bart Schaefer
2022-12-10 11:38   ` Daniel Shahaf
2022-12-11 18:35     ` Stephane Chazelas
2022-12-11 18:52       ` Bart Schaefer
2022-12-11 20:01         ` Stephane Chazelas [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221211200133.v5ih3ss2hx24lp4x@chazelas.org \
    --to=stephane@chazelas.org \
    --cc=d.s@daniel.shahaf.name \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).