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]

Re: [PATCH 2/2] libio: Fix seek-past-end returned size for open_{w}memstream (BZ#15298)


On 08/05/2016 07:40 PM, Adhemerval Zanella wrote:
+static _IO_off64_t
+_IO_wmem_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)
+{
+  struct _IO_FILE_wmemstream *mp = (struct _IO_FILE_wmemstream *) fp;
+  if (fp->_wide_data->_IO_write_ptr != mp->seekwriteptr)
+    mp->prevwriteptr = fp->_wide_data->_IO_write_ptr;
+  _IO_off64_t ret = _IO_wstr_seekoff (fp, offset, dir, mode);
+  mp->seekwriteptr = fp->_wide_data->_IO_write_ptr;
+  return ret;
+}

As far as I can see, glibc will not call seekoff from the vfprintf code, ever, and _IO_wstr_jumps is only used for that. This means the only actual use of _IO_wstr_seekoff is in the wmemstream code. So you could rename/move _IO_wstr_seekoff and change it directly. It should be fine to use a NULL pointer in _IO_wstr_jumops, just like _IO_obstack_jumps does.

In contrast, _IO_str_seekoff is used from libstdc++ in GCC 2.95, so we cannot change it.

Florian


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