This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH][BZ #14292] Do not inverse seek in fmemopen_seek.
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: libc-alpha at sourceware dot org
- Date: Mon, 20 May 2013 17:44:11 +0200
- Subject: [PATCH][BZ #14292] Do not inverse seek in fmemopen_seek.
Hi,
Another inconsistency in fmemopen is that seek inverses whence when
SEEK_END is specified. A fopen does not do this.
Do some programs depend on that or can I change this?
I will provide testcase only if this is ok to commit.
* libio/fmemopen.c: Do not inverse whence.
---
diff --git a/libio/fmemopen.c b/libio/fmemopen.c
index 02c764f..27ad234 100644
--- a/libio/fmemopen.c
+++ b/libio/fmemopen.c
@@ -165,7 +165,7 @@ fmemopen_seek (void *cookie, _IO_off64_t *p, int w)
break;
case SEEK_END:
- np = (c->binmode ? c->size : c->maxpos) - *p;
+ np = (c->binmode ? c->size : c->maxpos) + *p;
break;
default: