public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "siddhesh at redhat dot com" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sources.redhat.com Subject: [Bug stdio/14543] New: fseek sets invalid status in the internal buffer in wide mode Date: Tue, 04 Sep 2012 15:52:00 -0000 [thread overview] Message-ID: <bug-14543-131@http.sourceware.org/bugzilla/> (raw) http://sourceware.org/bugzilla/show_bug.cgi?id=14543 Bug #: 14543 Summary: fseek sets invalid status in the internal buffer in wide mode Product: glibc Version: unspecified Status: NEW Severity: normal Priority: P2 Component: stdio AssignedTo: unassigned@sourceware.org ReportedBy: siddhesh@redhat.com Classification: Unclassified fseek sets the pointers in the external buffer correctly, but initializes the internal buffer as if there's nothing in it. As a result, the position computed in a subsequent ftell is incorrect. How Reproducible: Always Reproducer program: #include <stdio.h> #include <stdlib.h> #include <locale.h> int main(int argc, char** argv) { FILE *fp; setlocale(LC_ALL, "en_US.utf8"); fp = fopen("output.txt", "w+"); if (fp == NULL) { perror("fopen"); exit(1); } if (fputws(L"abc\n", fp) == -1) { perror("fputws"); exit(1); } printf("before=%d\n", ftell(fp)); rewind (fp); if (fseek(fp, 0L, SEEK_END) == -1) { perror("fseek"); exit(1); } printf("fseek=%d\n", ftell(fp)); if (fputws(L"xyz\n", fp) == -1) { perror("fputws"); exit(1); } printf("after=%d\n", ftell(fp)); fclose(fp); } Actual result: before=4 fseek=0 after=4 Expected Result: before=4 fseek=4 after=8 -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
next reply other threads:[~2012-09-04 15:52 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-09-04 15:52 siddhesh at redhat dot com [this message] 2012-09-04 15:54 ` [Bug stdio/14543] " siddhesh at redhat dot com 2012-09-13 14:16 ` siddhesh at redhat dot com 2012-09-28 13:31 ` siddhesh at redhat dot com 2014-06-17 4:46 ` fweimer at redhat dot com
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: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-14543-131@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@sources.redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).