mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-22 02:40:08 +00:00
* sysdeps/unix/rewinddir.c: Reset filepos.
* dirent/tst-seekdir.c: Check telldir value after calling rewinddir. 2005-01-15 Ulrich Drepper <drepper@redhat.com> * elf/tst-auditmod1.c: Reduce duplication.
This commit is contained in:
parent
805ed74c10
commit
125a8cf7ff
@ -1,3 +1,12 @@
|
||||
2005-01-16 GOTO Masanori <gotom@debian.or.jp>
|
||||
|
||||
* sysdeps/unix/rewinddir.c: Reset filepos.
|
||||
* dirent/tst-seekdir.c: Check telldir value after calling rewinddir.
|
||||
|
||||
2005-01-15 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* elf/tst-auditmod1.c: Reduce duplication.
|
||||
|
||||
2005-01-16 Andreas Schwab <schwab@suse.de>
|
||||
|
||||
* sysdeps/m68k/dl-machine.h: Remove trampoline code. Define
|
||||
|
@ -11,8 +11,23 @@ main (int argc, char *argv[])
|
||||
int i = 0;
|
||||
int result = 0;
|
||||
struct dirent *dp;
|
||||
long int save0;
|
||||
long int rewind;
|
||||
|
||||
dirp = opendir (".");
|
||||
if (dirp == NULL)
|
||||
{
|
||||
printf ("opendir failed: %m\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
save0 = telldir (dirp);
|
||||
if (save0 == -1)
|
||||
{
|
||||
printf ("telldir failed: %m\n");
|
||||
result = 1;
|
||||
}
|
||||
|
||||
for (dp = readdir (dirp); dp != NULL; dp = readdir (dirp))
|
||||
{
|
||||
/* save position 3 (after fourth entry) */
|
||||
@ -44,6 +59,19 @@ main (int argc, char *argv[])
|
||||
for (dp = readdir (dirp); dp != NULL; dp = readdir (dirp))
|
||||
printf ("%s\n", dp->d_name);
|
||||
|
||||
/* Check rewinddir */
|
||||
rewinddir (dirp);
|
||||
rewind = telldir (dirp);
|
||||
if (rewind == -1)
|
||||
{
|
||||
printf ("telldir failed: %m\n");
|
||||
result = 1;
|
||||
}
|
||||
else if (save0 != rewind)
|
||||
{
|
||||
printf ("rewinddir didn't reset directory stream\n");
|
||||
result = 1;
|
||||
}
|
||||
|
||||
closedir (dirp);
|
||||
return result;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991, 1995-1998, 2005 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -30,6 +30,7 @@ rewinddir (dirp)
|
||||
{
|
||||
__libc_lock_lock (dirp->lock);
|
||||
(void) __lseek (dirp->fd, (off_t) 0, SEEK_SET);
|
||||
dirp->filepos = 0;
|
||||
dirp->offset = 0;
|
||||
dirp->size = 0;
|
||||
__libc_lock_unlock (dirp->lock);
|
||||
|
Loading…
Reference in New Issue
Block a user