1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00

Use al possible bytes from fopen mode string.

This commit is contained in:
Eric Blake
2011-04-22 23:40:57 -04:00
committed by Ulrich Drepper
parent 4df46dbda7
commit b722481ac2
3 changed files with 24 additions and 17 deletions

View File

@ -290,7 +290,7 @@ _IO_new_file_fopen (fp, filename, mode, is32not64)
#ifdef _LIBC
last_recognized = mode;
#endif
for (i = 1; i < 6; ++i)
for (i = 1; i < 7; ++i)
{
switch (*++mode)
{
@ -997,18 +997,18 @@ _IO_new_file_seekoff (fp, offset, dir, mode)
/* Adjust for read-ahead (bytes is buffer). */
offset -= fp->_IO_read_end - fp->_IO_read_ptr;
if (fp->_offset == _IO_pos_BAD)
{
if (mode != 0)
goto dumb;
else
{
result = _IO_SYSSEEK (fp, 0, dir);
if (result == EOF)
return result;
{
if (mode != 0)
goto dumb;
else
{
result = _IO_SYSSEEK (fp, 0, dir);
if (result == EOF)
return result;
fp->_offset = result;
}
}
fp->_offset = result;
}
}
/* Make offset absolute, assuming current pointer is file_ptr(). */
offset += fp->_offset;
if (offset < 0)
@ -1270,7 +1270,7 @@ _IO_new_file_write (f, data, n)
{
f->_flags |= _IO_ERR_SEEN;
break;
}
}
to_do -= count;
data = (void *) ((char *) data + count);
}
@ -1358,12 +1358,12 @@ _IO_new_file_xsputn (f, data, n)
do_write = to_do - (block_size >= 128 ? to_do % block_size : 0);
if (do_write)
{
{
count = new_do_write (f, s, do_write);
to_do -= count;
if (count < do_write)
return n - to_do;
}
}
/* Now write out the remainder. Normally, this will fit in the
buffer, but it's somewhat messier for line-buffered files,