mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-18 14:40:06 +00:00
Update.
1999-06-07 Ulrich Drepper <drepper@cygnus.com> * grp/fgetgrent.c (fgetgrent): Remember position of stream before reading and reset in case the buffer was too small. * grp/fgetgrent_r.c (__fgetgrent_r): Set errno to ENOENT in case of EOF.
This commit is contained in:
parent
15828e9d78
commit
db873f322b
@ -1,3 +1,11 @@
|
|||||||
|
1999-06-07 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
|
* grp/fgetgrent.c (fgetgrent): Remember position of stream before
|
||||||
|
reading and reset in case the buffer was too small.
|
||||||
|
|
||||||
|
* grp/fgetgrent_r.c (__fgetgrent_r): Set errno to ENOENT in case
|
||||||
|
of EOF.
|
||||||
|
|
||||||
1999-06-07 Andreas Jaeger <aj@arthur.rhein-neckar.de>
|
1999-06-07 Andreas Jaeger <aj@arthur.rhein-neckar.de>
|
||||||
|
|
||||||
* sysdeps/unix/sysv/linux/if_index.c: Use SIGIOCGIFINDEX and fix
|
* sysdeps/unix/sysv/linux/if_index.c: Use SIGIOCGIFINDEX and fix
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 1991, 1996, 1997 Free Software Foundation, Inc.
|
/* Copyright (C) 1991, 1996, 1997, 1999 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -19,6 +19,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
#include <bits/libc-lock.h>
|
#include <bits/libc-lock.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
@ -32,9 +33,13 @@ fgetgrent (FILE *stream)
|
|||||||
static char *buffer;
|
static char *buffer;
|
||||||
static size_t buffer_size;
|
static size_t buffer_size;
|
||||||
static struct group resbuf;
|
static struct group resbuf;
|
||||||
|
fpos_t pos;
|
||||||
struct group *result;
|
struct group *result;
|
||||||
int save;
|
int save;
|
||||||
|
|
||||||
|
if (fgetpos (stream, &pos) != 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
/* Get lock. */
|
/* Get lock. */
|
||||||
__libc_lock_lock (lock);
|
__libc_lock_lock (lock);
|
||||||
|
|
||||||
@ -61,6 +66,13 @@ fgetgrent (FILE *stream)
|
|||||||
__set_errno (save);
|
__set_errno (save);
|
||||||
}
|
}
|
||||||
buffer = new_buf;
|
buffer = new_buf;
|
||||||
|
|
||||||
|
/* Reset the stream. */
|
||||||
|
if (fsetpos (stream, &pos) != 0)
|
||||||
|
{
|
||||||
|
buffer = NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buffer == NULL)
|
if (buffer == NULL)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 1991, 1996, 1997, 1998 Free Software Foundation, Inc.
|
/* Copyright (C) 1991, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -74,13 +74,15 @@ __fgetgrent_r (FILE *stream, struct group *resbuf, char *buffer, size_t buflen,
|
|||||||
{
|
{
|
||||||
funlockfile (stream);
|
funlockfile (stream);
|
||||||
*result = NULL;
|
*result = NULL;
|
||||||
|
__set_errno (ENOENT);
|
||||||
return errno;
|
return errno;
|
||||||
}
|
}
|
||||||
if (p == NULL || buffer[buflen - 1] != '\xff')
|
if (p == NULL || buffer[buflen - 1] != '\xff')
|
||||||
{
|
{
|
||||||
funlockfile (stream);
|
funlockfile (stream);
|
||||||
*result = NULL;
|
*result = NULL;
|
||||||
return errno = ERANGE;
|
__set_errno (ERANGE);
|
||||||
|
return errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Skip leading blanks. */
|
/* Skip leading blanks. */
|
||||||
|
Loading…
Reference in New Issue
Block a user