NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lib/42879: rewinddir(3) doesn't reset the stream



The following reply was made to PR lib/42879; it has been noted by GNATS.

From: David Holland <dholland-bugs%netbsd.org@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: lib/42879: rewinddir(3) doesn't reset the stream
Date: Mon, 8 Aug 2011 08:25:47 +0000

 this didn't get filed in gnats back in May.
 
    ------
 
 From: "T.SHIOZAKI" <tshiozak%bsdclub.org@localhost>
 To: yamt%NetBSD.org@localhost, lib-bug-people%NetBSD.org@localhost, 
gnats-admin%NetBSD.org@localhost,
        netbsd-bugs%NetBSD.org@localhost
 Subject: Re: PR/42879 CVS commit: src
 Date: Mon, 16 May 2011 18:38:56 +0900 (JST)
 
 
 Hi,
 
 This fix breaks compatibility for pre-3.0 binaries.
 
 Here is a patch. (I don't know whether such __RENAME() usage is appropriate.)
 
 
 Index: lib/libc/compat/gen/Makefile.inc
 ===================================================================
 RCS file: /usr/home/cvs/NetBSD/src/lib/libc/compat/gen/Makefile.inc,v
 retrieving revision 1.14
 diff -u -r1.14 Makefile.inc
 --- lib/libc/compat/gen/Makefile.inc   12 Mar 2011 19:52:47 -0000      1.14
 +++ lib/libc/compat/gen/Makefile.inc   16 May 2011 08:44:57 -0000
 @@ -3,8 +3,9 @@
  .PATH: ${COMPATDIR}/gen
  SRCS+=compat_errlist.c compat_fts.c compat___fts13.c compat___fts30.c \
      compat___fts31.c compat_getmntinfo.c compat_glob.c compat___glob13.c \
 -    compat_opendir.c compat_readdir.c compat__readdir_unlocked30.c \
 -    compat_scandir.c compat_siglist.c compat_signame.c compat_sigsetops.c \
 +    compat_opendir.c compat_initdir.c compat_readdir.c \
 +    compat__readdir_unlocked30.c compat_scandir.c \
 +    compat_siglist.c compat_signame.c compat_sigsetops.c \
      compat_times.c compat_timezone.c compat_unvis.c compat_utmpx.c \
      compat__sys_errlist.c compat__sys_nerr.c compat__sys_siglist.c \
      compat_time.c compat_utime.c compat_devname.c compat_alphasort.c \
 Index: lib/libc/compat/include/dirent.h
 ===================================================================
 RCS file: /usr/home/cvs/NetBSD/src/lib/libc/compat/include/dirent.h,v
 retrieving revision 1.7
 diff -u -r1.7 dirent.h
 --- lib/libc/compat/include/dirent.h   24 Feb 2009 18:42:36 -0000      1.7
 +++ lib/libc/compat/include/dirent.h   16 May 2011 09:25:39 -0000
 @@ -51,6 +51,9 @@
  
  #if defined(_NETBSD_SOURCE)
  
 +int _initdir(DIR *, int, const char *);
 +int ___initdir60(DIR *, int, const char *);
 +
  struct dirent12 *_readdir_unlocked(DIR *, int);
  struct dirent *___readdir_unlocked50(DIR *, int);
  struct dirent *___readdir_unlocked30(DIR *);
 Index: lib/libc/gen/Makefile.inc
 ===================================================================
 RCS file: /usr/home/cvs/NetBSD/src/lib/libc/gen/Makefile.inc,v
 retrieving revision 1.178
 diff -u -r1.178 Makefile.inc
 --- lib/libc/gen/Makefile.inc  26 Mar 2011 19:51:42 -0000      1.178
 +++ lib/libc/gen/Makefile.inc  16 May 2011 08:41:54 -0000
 @@ -9,7 +9,7 @@
        confstr.c ctermid.c ctype_.c daemon.c \
        dehumanize_number.c devname.c dirname.c disklabel.c err.c errx.c \
        errlist.c errno.c execl.c execle.c execlp.c execv.c execvp.c \
 -      extattr.c fmtcheck.c fmtmsg.c fnmatch.c fstab.c ftok.c \
 +      extattr.c finidir.c fmtcheck.c fmtmsg.c fnmatch.c fstab.c ftok.c \
        fts.c ftw.c getbsize.c getcap.c getcwd.c \
        getdevmajor.c getdomainname.c getgrent.c \
        getgrouplist.c getgroupmembership.c gethostname.c \
 Index: lib/libc/gen/dirent_private.h
 ===================================================================
 RCS file: /usr/home/cvs/NetBSD/src/lib/libc/gen/dirent_private.h,v
 retrieving revision 1.4
 diff -u -r1.4 dirent_private.h
 --- lib/libc/gen/dirent_private.h      26 Sep 2010 02:26:59 -0000      1.4
 +++ lib/libc/gen/dirent_private.h      16 May 2011 09:25:47 -0000
 @@ -15,10 +15,10 @@
  struct _dirdesc;
  void _seekdir_unlocked(struct _dirdesc *, long);
  long _telldir_unlocked(struct _dirdesc *);
 -int _initdir(DIR *, int, const char *);
  void _finidir(DIR *);
  #ifndef __LIBC12_SOURCE__
  struct dirent;
 +int _initdir(DIR *, int, const char *) __RENAME(___initdir60);
  struct dirent *_readdir_unlocked(struct _dirdesc *, int)
      __RENAME(___readdir_unlocked50);
  #endif
 Index: lib/libc/gen/finidir.c
 ===================================================================
 RCS file: lib/libc/gen/finidir.c
 diff -N lib/libc/gen/finidir.c
 --- /dev/null  1 Jan 1970 00:00:00 -0000
 +++ lib/libc/gen/finidir.c     16 May 2011 09:03:10 -0000
 @@ -0,0 +1,63 @@
 +/*    $NetBSD: initdir.c,v 1.1 2010/09/26 02:26:59 yamt Exp $ */
 +
 +/*
 + * Copyright (c) 1983, 1993
 + *    The Regents of the University of California.  All rights reserved.
 + *
 + * Redistribution and use in source and binary forms, with or without
 + * modification, are permitted provided that the following conditions
 + * are met:
 + * 1. Redistributions of source code must retain the above copyright
 + *    notice, this list of conditions and the following disclaimer.
 + * 2. Redistributions in binary form must reproduce the above copyright
 + *    notice, this list of conditions and the following disclaimer in the
 + *    documentation and/or other materials provided with the distribution.
 + * 3. Neither the name of the University nor the names of its contributors
 + *    may be used to endorse or promote products derived from this software
 + *    without specific prior written permission.
 + *
 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 + * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 + * SUCH DAMAGE.
 + */
 +
 +#include <sys/cdefs.h>
 +#if defined(LIBC_SCCS) && !defined(lint)
 +__RCSID("$NetBSD: initdir.c,v 1.1 2010/09/26 02:26:59 yamt Exp $");
 +#endif /* LIBC_SCCS and not lint */
 +
 +#include "namespace.h"
 +#include "reentrant.h"
 +#include "extern.h"
 +
 +#include <sys/param.h>
 +
 +#include <assert.h>
 +#include <dirent.h>
 +#include <stdlib.h>
 +
 +#include "dirent_private.h"
 +
 +void
 +_finidir(DIR *dirp)
 +{
 +      struct dirpos *poslist;
 +
 +      free(dirp->dd_buf);
 +
 +      /* free seekdir/telldir storage */
 +      for (poslist = dirp->dd_internal; poslist; ) {
 +              struct dirpos *nextpos = poslist->dp_next;
 +              free(poslist);
 +              poslist = nextpos;
 +      }
 +      dirp->dd_internal = NULL;
 +}
 Index: lib/libc/gen/initdir.c
 ===================================================================
 RCS file: /usr/home/cvs/NetBSD/src/lib/libc/gen/initdir.c,v
 retrieving revision 1.1
 diff -u -r1.1 initdir.c
 --- lib/libc/gen/initdir.c     26 Sep 2010 02:26:59 -0000      1.1
 +++ lib/libc/gen/initdir.c     16 May 2011 08:40:33 -0000
 @@ -256,19 +256,3 @@
        (void)_telldir_unlocked(dirp);
        return 0;
  }
 -
 -void
 -_finidir(DIR *dirp)
 -{
 -      struct dirpos *poslist;
 -
 -      free(dirp->dd_buf);
 -
 -      /* free seekdir/telldir storage */
 -      for (poslist = dirp->dd_internal; poslist; ) {
 -              struct dirpos *nextpos = poslist->dp_next;
 -              free(poslist);
 -              poslist = nextpos;
 -      }
 -      dirp->dd_internal = NULL;
 -}
 


Home | Main Index | Thread Index | Old Index