From bebb25961c1ed29d217b1a40fc69c77ebdc18bcd Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sun, 10 Feb 2008 15:19:08 +0000 Subject: [PATCH] * libc/ftw.cc (ftw): Allow nfds < 0 for glibc compatibility. * libc/nftw.c (nftw): Ditto. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/libc/ftw.c | 5 +++++ winsup/cygwin/libc/nftw.c | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 0bc77014e..e1d6a109c 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2008-02-10 Corinna Vinschen + + * libc/ftw.cc (ftw): Allow nfds < 0 for glibc compatibility. + * libc/nftw.c (nftw): Ditto. + 2008-02-07 Corinna Vinschen * dtable.cc (dtable::init_std_file_from_handle): Set access to diff --git a/winsup/cygwin/libc/ftw.c b/winsup/cygwin/libc/ftw.c index 2589e5b4f..9863e1621 100644 --- a/winsup/cygwin/libc/ftw.c +++ b/winsup/cygwin/libc/ftw.c @@ -49,11 +49,16 @@ ftw(const char *path, int (*fn)(const char *, const struct __stat64 *, int), FTS *ftsp; int error = 0, fnflag, sverrno; +#if 0 + /* GLibc allows nfds < 1 and treats it as nfds == 1. Since nfds is + not used in this OpenBSD version anyway, just ignore it for + Linux compatibility. */ /* XXX - nfds is currently unused */ if (nfds < 1 || nfds > OPEN_MAX) { errno = EINVAL; return (-1); } +#endif ftsp = fts_open(paths, FTS_LOGICAL | FTS_COMFOLLOW | FTS_NOCHDIR, NULL); if (ftsp == NULL) diff --git a/winsup/cygwin/libc/nftw.c b/winsup/cygwin/libc/nftw.c index f7c06b29d..bb1c92381 100644 --- a/winsup/cygwin/libc/nftw.c +++ b/winsup/cygwin/libc/nftw.c @@ -50,11 +50,16 @@ nftw(const char *path, int (*fn)(const char *, const struct __stat64 *, int, FTS *ftsp; int error = 0, ftsflags, fnflag, postorder, sverrno; +#if 0 + /* GLibc allows nfds < 1 and treats it as nfds == 1. Since nfds is + not used in this OpenBSD version anyway, just ignore it for + Linux compatibility. */ /* XXX - nfds is currently unused */ if (nfds < 1 || nfds > OPEN_MAX) { errno = EINVAL; return (-1); } +#endif ftsflags = FTS_COMFOLLOW; if (!(ftwflags & FTW_CHDIR))