mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-30 22:43:12 +03:00
Update.
1999-06-09 Ulrich Drepper <drepper@cygnus.com> * pwd/fgetpwent_r.c: Set errno in the correct way. * shadow/fgetspent_r.c: Likewise. * pwd/fgetpwent.c: Handle long lines correctly. Little optimizations. Free static buffer when debugging memory handling. * shadow/fgetspent.c: Likewise. * grp/fgetgrent.c: Little optimization in loop. 1999-06-09 Andreas Jaeger <aj@arthur.rhein-neckar.de> * grp/tst_fgetgrent.c (write_group): Fix generation of long line in a different way.
This commit is contained in:
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
|||||||
|
1999-06-09 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
|
* pwd/fgetpwent_r.c: Set errno in the correct way.
|
||||||
|
* shadow/fgetspent_r.c: Likewise.
|
||||||
|
* pwd/fgetpwent.c: Handle long lines correctly. Little
|
||||||
|
optimizations. Free static buffer when debugging memory handling.
|
||||||
|
* shadow/fgetspent.c: Likewise.
|
||||||
|
|
||||||
|
* grp/fgetgrent.c: Little optimization in loop.
|
||||||
|
|
||||||
|
1999-06-09 Andreas Jaeger <aj@arthur.rhein-neckar.de>
|
||||||
|
|
||||||
|
* grp/tst_fgetgrent.c (write_group): Fix generation of long line
|
||||||
|
in a different way.
|
||||||
|
|
||||||
1999-06-09 Jakub Jelinek <jj@ultra.linux.cz>
|
1999-06-09 Jakub Jelinek <jj@ultra.linux.cz>
|
||||||
|
|
||||||
* stdlib/longlong.h: gas changed sethi handling when without
|
* stdlib/longlong.h: gas changed sethi handling when without
|
||||||
|
@ -52,8 +52,8 @@ fgetgrent (FILE *stream)
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (buffer != NULL
|
while (buffer != NULL
|
||||||
&& __fgetgrent_r (stream, &resbuf, buffer, buffer_size, &result) != 0
|
&& (__fgetgrent_r (stream, &resbuf, buffer, buffer_size, &result)
|
||||||
&& errno == ERANGE)
|
== ERANGE))
|
||||||
{
|
{
|
||||||
char *new_buf;
|
char *new_buf;
|
||||||
buffer_size += NSS_BUFLEN_GROUP;
|
buffer_size += NSS_BUFLEN_GROUP;
|
||||||
@ -70,10 +70,7 @@ fgetgrent (FILE *stream)
|
|||||||
|
|
||||||
/* Reset the stream. */
|
/* Reset the stream. */
|
||||||
if (fsetpos (stream, &pos) != 0)
|
if (fsetpos (stream, &pos) != 0)
|
||||||
{
|
buffer = NULL;
|
||||||
buffer = NULL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buffer == NULL)
|
if (buffer == NULL)
|
||||||
|
@ -32,9 +32,12 @@ write_users (FILE *f, int large_pos, int pos)
|
|||||||
|
|
||||||
if (pos == large_pos)
|
if (pos == large_pos)
|
||||||
{
|
{
|
||||||
|
if (large_pos == 3)
|
||||||
|
fprintf (f, ":three");
|
||||||
|
|
||||||
/* we need more than 2048 bytes for proper testing. */
|
/* we need more than 2048 bytes for proper testing. */
|
||||||
for (i = 0; i < 500; i++)
|
for (i = 0; i < 500; i++)
|
||||||
fprintf (f, "%suser%03d", i == 0 ? ":" : ",", i);
|
fprintf (f, ",user%03d", i);
|
||||||
}
|
}
|
||||||
fprintf (f, "\n");
|
fprintf (f, "\n");
|
||||||
|
|
||||||
|
@ -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,22 +19,28 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <bits/libc-lock.h>
|
#include <bits/libc-lock.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
/* We need to protect the dynamic buffer handling. */
|
/* We need to protect the dynamic buffer handling. */
|
||||||
__libc_lock_define_initialized (static, lock);
|
__libc_lock_define_initialized (static, lock);
|
||||||
|
|
||||||
|
static char *buffer;
|
||||||
|
|
||||||
/* Read one entry from the given stream. */
|
/* Read one entry from the given stream. */
|
||||||
struct passwd *
|
struct passwd *
|
||||||
fgetpwent (FILE *stream)
|
fgetpwent (FILE *stream)
|
||||||
{
|
{
|
||||||
static char *buffer;
|
|
||||||
static size_t buffer_size;
|
static size_t buffer_size;
|
||||||
static struct passwd resbuf;
|
static struct passwd resbuf;
|
||||||
|
fpos_t pos;
|
||||||
struct passwd *result;
|
struct passwd *result;
|
||||||
int save;
|
int save;
|
||||||
|
|
||||||
|
if (fgetpos (stream, &pos) != 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
/* Get lock. */
|
/* Get lock. */
|
||||||
__libc_lock_lock (lock);
|
__libc_lock_lock (lock);
|
||||||
|
|
||||||
@ -46,8 +52,8 @@ fgetpwent (FILE *stream)
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (buffer != NULL
|
while (buffer != NULL
|
||||||
&& __fgetpwent_r (stream, &resbuf, buffer, buffer_size, &result) != 0
|
&& (__fgetpwent_r (stream, &resbuf, buffer, buffer_size, &result)
|
||||||
&& errno == ERANGE)
|
== ERANGE))
|
||||||
{
|
{
|
||||||
char *new_buf;
|
char *new_buf;
|
||||||
buffer_size += NSS_BUFLEN_PASSWD;
|
buffer_size += NSS_BUFLEN_PASSWD;
|
||||||
@ -61,6 +67,10 @@ fgetpwent (FILE *stream)
|
|||||||
__set_errno (save);
|
__set_errno (save);
|
||||||
}
|
}
|
||||||
buffer = new_buf;
|
buffer = new_buf;
|
||||||
|
|
||||||
|
/* Reset the stream. */
|
||||||
|
if (fsetpos (stream, &pos) != 0)
|
||||||
|
buffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buffer == NULL)
|
if (buffer == NULL)
|
||||||
@ -73,3 +83,14 @@ fgetpwent (FILE *stream)
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Free all resources if necessary. */
|
||||||
|
static void __attribute__ ((unused))
|
||||||
|
free_mem (void)
|
||||||
|
{
|
||||||
|
if (buffer != NULL)
|
||||||
|
free (buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
text_set_element (__libc_subfreeres, free_mem);
|
||||||
|
@ -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
|
||||||
@ -92,7 +92,8 @@ __fgetpwent_r (FILE *stream, struct passwd *resbuf, char *buffer,
|
|||||||
{
|
{
|
||||||
funlockfile (stream);
|
funlockfile (stream);
|
||||||
*result = NULL;
|
*result = NULL;
|
||||||
return errno = ERANGE;
|
__set_errno (ERANGE);
|
||||||
|
return errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Skip leading blanks. */
|
/* Skip leading blanks. */
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
/* Copyright (C) 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 <bits/libc-lock.h>
|
#include <bits/libc-lock.h>
|
||||||
#include <shadow.h>
|
#include <shadow.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
@ -28,16 +29,21 @@
|
|||||||
/* We need to protect the dynamic buffer handling. */
|
/* We need to protect the dynamic buffer handling. */
|
||||||
__libc_lock_define_initialized (static, lock);
|
__libc_lock_define_initialized (static, lock);
|
||||||
|
|
||||||
|
static char *buffer;
|
||||||
|
|
||||||
/* Read one shadow entry from the given stream. */
|
/* Read one shadow entry from the given stream. */
|
||||||
struct spwd *
|
struct spwd *
|
||||||
fgetspent (FILE *stream)
|
fgetspent (FILE *stream)
|
||||||
{
|
{
|
||||||
static char *buffer;
|
|
||||||
static size_t buffer_size;
|
static size_t buffer_size;
|
||||||
static struct spwd resbuf;
|
static struct spwd resbuf;
|
||||||
|
fpos_t pos;
|
||||||
struct spwd *result;
|
struct spwd *result;
|
||||||
int save;
|
int save;
|
||||||
|
|
||||||
|
if (fgetpos (stream, &pos) != 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
/* Get lock. */
|
/* Get lock. */
|
||||||
__libc_lock_lock (lock);
|
__libc_lock_lock (lock);
|
||||||
|
|
||||||
@ -49,8 +55,8 @@ fgetspent (FILE *stream)
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (buffer != NULL
|
while (buffer != NULL
|
||||||
&& __fgetspent_r (stream, &resbuf, buffer, buffer_size, &result) != 0
|
&& (__fgetspent_r (stream, &resbuf, buffer, buffer_size, &result)
|
||||||
&& errno == ERANGE)
|
== ERANGE))
|
||||||
{
|
{
|
||||||
char *new_buf;
|
char *new_buf;
|
||||||
buffer_size += BUFLEN_SPWD;
|
buffer_size += BUFLEN_SPWD;
|
||||||
@ -64,6 +70,10 @@ fgetspent (FILE *stream)
|
|||||||
__set_errno (save);
|
__set_errno (save);
|
||||||
}
|
}
|
||||||
buffer = new_buf;
|
buffer = new_buf;
|
||||||
|
|
||||||
|
/* Reset the stream. */
|
||||||
|
if (fsetpos (stream, &pos) != 0)
|
||||||
|
buffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buffer == NULL)
|
if (buffer == NULL)
|
||||||
@ -76,3 +86,14 @@ fgetspent (FILE *stream)
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Free all resources if necessary. */
|
||||||
|
static void __attribute__ ((unused))
|
||||||
|
free_mem (void)
|
||||||
|
{
|
||||||
|
if (buffer != NULL)
|
||||||
|
free (buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
text_set_element (__libc_subfreeres, free_mem);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
|
/* Copyright (C) 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
|
||||||
@ -59,7 +59,8 @@ __fgetspent_r (FILE *stream, struct spwd *resbuf, char *buffer, size_t buflen,
|
|||||||
{
|
{
|
||||||
funlockfile (stream);
|
funlockfile (stream);
|
||||||
*result = NULL;
|
*result = NULL;
|
||||||
return errno = ERANGE;
|
__set_errno (ERANGE);
|
||||||
|
return errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Skip leading blanks. */
|
/* Skip leading blanks. */
|
||||||
|
Reference in New Issue
Block a user