public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/6544] New: fseek(..., 0, SEEK_END) doesn't work as it should on fmemopen's FILE
@ 2008-05-22  6:27 witekfl at poczta dot onet dot pl
  2008-05-22  6:30 ` [Bug libc/6544] " witekfl at poczta dot onet dot pl
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: witekfl at poczta dot onet dot pl @ 2008-05-22  6:27 UTC (permalink / raw)
  To: glibc-bugs

fmemopen_seek in case of SEEK_END set the seek position on the first '\0' char
what is wrong. This way fmemopen is unusable with binary data.
I tried to use fmemopen with zziplib library to open a ZIP file which was
already loaded into memory, but it failed. With the patch below it works fine. 


--- glibc-2.8/libio/fmemopen.c.old      2008-05-21 23:40:18.000000000 +0200
+++ glibc-2.8/libio/fmemopen.c  2008-05-21 23:42:51.000000000 +0200
@@ -165,7 +165,7 @@ fmemopen_seek (void *cookie, _IO_off64_t
       break;

     case SEEK_END:
-      np = c->maxpos - *p;
+      np = c->size - *p;
       break;

     default:

-- 
           Summary: fseek(..., 0, SEEK_END) doesn't work as it should on
                    fmemopen's FILE
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: witekfl at poczta dot onet dot pl
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=6544

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-05-28 19:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-6544-131@http.sourceware.org/bugzilla/>
2012-04-27 20:22 ` [Bug libc/6544] fseek(..., 0, SEEK_END) doesn't work as it should on fmemopen's FILE mtk.manpages at gmail dot com
2012-04-28  2:34 ` mtk.manpages at gmail dot com
2012-04-28  3:37 ` mtk.manpages at gmail dot com
2014-02-16 18:23 ` jackie.rosen at hushmail dot com
2014-05-28 19:46 ` schwab at sourceware dot org
2008-05-22  6:27 [Bug libc/6544] New: " witekfl at poczta dot onet dot pl
2008-05-22  6:30 ` [Bug libc/6544] " witekfl at poczta dot onet dot pl
2008-05-22  6:32 ` witekfl at poczta dot onet dot pl
2008-08-14  6:36 ` drepper at redhat dot com
2008-08-14 16:55 ` ebb9 at byu dot net

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