This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]