|
Message-ID: <20220122155057.GA11883@voyager> Date: Sat, 22 Jan 2022 16:50:57 +0100 From: Markus Wichmann <nullplan@....net> To: musl@...ts.openwall.com Subject: Re: [PATCH v2 1/2] nftw: implement FTW_CHDIR On Sat, Jan 22, 2022 at 03:51:58PM +0100, Ismael Luceno wrote: > @@ -133,9 +136,16 @@ int nftw(const char *path, int (*fn)(const char *, const struct stat *, int, str > } > memcpy(pathbuf, path, l+1); > > + if (flags & FTW_CHDIR) > + orig_dfd = open(".", O_CLOEXEC | O_PATH); > + > pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs); > r = do_nftw(pathbuf, fn, fd_limit, flags, NULL); > pthread_setcancelstate(cs, 0); > + if (flags & FTW_CHDIR) { > + fchdir(orig_dfd); > + close(orig_dfd); > + } > return r; > } > > -- > 2.33.0 > Erm... maybe a dumb question, but what if either the open() or the fchdir() fails? Is anything specified for that case? Is effectively ignoring FTW_CHDIR OK in that case or would you have to signal failure? I mean, I see that there is not much you can do in either case, but to just fail silently seems wrong to me. Ciao, Markus
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.