X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fmisc%2Fnftw.c;h=efb2b89524747397b0ccf3e5bbfb5438fd9ecd87;hb=b3516058eb9ff9e52a8720f0e5c0f6936cce6047;hp=1b94ac158aa106b7c4d0fb1777c932c0470ad3c3;hpb=0b44a0315b47dd8eced9f3b7f31580cf14bbfc01;p=musl diff --git a/src/misc/nftw.c b/src/misc/nftw.c index 1b94ac15..efb2b895 100644 --- a/src/misc/nftw.c +++ b/src/misc/nftw.c @@ -2,11 +2,10 @@ #include #include #include -#include -#include #include #include #include +#include #include "libc.h" struct history @@ -47,8 +46,7 @@ static int do_nftw(char *path, int (*fn)(const char *, const struct stat *, int, type = FTW_F; } - if ((flags & FTW_MOUNT) && h - && (st.st_dev != h->dev || st.st_ino != h->ino)) + if ((flags & FTW_MOUNT) && h && st.st_dev != h->dev) return 0; new.chain = h; @@ -103,6 +101,7 @@ static int do_nftw(char *path, int (*fn)(const char *, const struct stat *, int, int nftw(const char *path, int (*fn)(const char *, const struct stat *, int, struct FTW *), int fd_limit, int flags) { + int r, cs; size_t l; char pathbuf[PATH_MAX+1]; @@ -115,7 +114,10 @@ int nftw(const char *path, int (*fn)(const char *, const struct stat *, int, str } memcpy(pathbuf, path, l+1); - return do_nftw(pathbuf, fn, fd_limit, flags, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs); + r = do_nftw(pathbuf, fn, fd_limit, flags, NULL); + pthread_setcancelstate(cs, 0); + return r; } LFS64(nftw);