This is the mail archive of the
libc-hacker@sourceware.cygnus.com
mailing list for the glibc project.
Another patch for libio
- To: drepper@cygnus.com (Ulrich Drepper)
- Subject: Another patch for libio
- From: hjl@lucon.org (H.J. Lu)
- Date: Sat, 24 Oct 1998 18:10:35 -0700 (PDT)
- Cc: libc-hacker@cygnus.com (GNU C Library)
Those are checked by VSX-PCT.
--
H.J. Lu (hjl@gnu.org)
---
Sat Oct 24 18:09:03 1998 H.J. Lu <hjl@gnu.org>
* libio/ioseekoff.c (_IO_seekoff): Check the valid dir value.
* libio/rewind.c (rewind): Clear the error.
Index: libio/ioseekoff.c
===================================================================
RCS file: /home/work/cvs/gnu/glibc/libio/ioseekoff.c,v
retrieving revision 1.1.1.6
diff -u -p -r1.1.1.6 ioseekoff.c
--- ioseekoff.c 1998/09/23 14:07:45 1.1.1.6
+++ ioseekoff.c 1998/10/22 23:35:06
@@ -24,6 +24,13 @@
General Public License. */
#include <libioP.h>
+#include <errno.h>
+#ifndef errno
+extern int errno;
+#endif
+#ifndef __set_errno
+# define __set_errno(Val) errno = (Val)
+#endif
_IO_fpos64_t
_IO_seekoff (fp, offset, dir, mode)
@@ -40,6 +47,12 @@ _IO_seekoff (fp, offset, dir, mode)
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
_IO_flockfile (fp);
+ if (dir != _IO_seek_cur && dir != _IO_seek_set && dir != _IO_seek_end)
+ {
+ /* Checked by VSX-PCT. */
+ __set_errno (EINVAL);
+ return EOF;
+ }
if (mode != 0 && _IO_have_backup (fp))
{
Index: libio/rewind.c
===================================================================
RCS file: /home/work/cvs/gnu/glibc/libio/rewind.c,v
retrieving revision 1.1.1.3
diff -u -p -r1.1.1.3 rewind.c
--- rewind.c 1998/06/13 18:31:09 1.1.1.3
+++ rewind.c 1998/10/23 00:10:13
@@ -34,6 +34,7 @@ rewind (fp)
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
_IO_flockfile (fp);
_IO_rewind (fp);
+ _IO_clearerr (fp);
_IO_funlockfile (fp);
_IO_cleanup_region_end (0);
}