mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Florian Weimer <>
To: "Buchholz, Robert" <>
Cc: "" <>
Subject: Re: [musl] Bug: ftell() after fopen(..., "ab") returns 0 unless an explicit fseek() is used first
Date: Thu, 11 Aug 2022 13:36:33 +0200	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <> (Robert Buchholz's message of "Thu, 11 Aug 2022 11:14:09 +0000")

* Robert Buchholz:

> On my Alpine/MUSL setup this prints "0 6" while on Ubuntu 22.04 with
> glibc it prints "3 6" - which I'm assuming is the expected output.

Both behaviors are acceptable.  C11 (7.21.3p1) says this:

| If a file can support positioning requests (such as a disk file, as
| opposed to a terminal), then a file position indicator associated with
| the stream is positioned at the start (character number zero) of the
| file, unless the file is opened with append mode in which case it is
| implementation-defined whether the file position indicator is initially
| positioned at the beginning or the end of the file.

musl is likely not the only libc with this type of behavior, given that
it's explicitly allowed by the standard.


  reply	other threads:[~2022-08-11 11:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-11 11:14 Buchholz, Robert
2022-08-11 11:36 ` Florian Weimer [this message]
2022-08-18  0:31   ` Rich Felker

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 \ \ \ \ \

* 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).