Deutsch English Français Italiano |
<0e9619f7d873a4ec436f017bac1192c73c5283e5.camel@gmail.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: wij <wyniijj5@gmail.com> Newsgroups: comp.lang.c Subject: Re: encapsulating directory operations Date: Sat, 07 Jun 2025 04:04:24 +0800 Organization: A noiseless patient Spider Lines: 59 Message-ID: <0e9619f7d873a4ec436f017bac1192c73c5283e5.camel@gmail.com> References: <100h650$23r5l$1@dont-email.me> <101ft3d$1feqh$2@dont-email.me> <101gq6l$1rdgj$1@raubtier-asyl.eternal-september.org> <101h0an$1tkqk$1@dont-email.me> <101jk7i$34erh$1@raubtier-asyl.eternal-september.org> <1nj%P.3454$mAv4.2422@fx34.iad> <101nc3o$5pjd$1@raubtier-asyl.eternal-september.org> <h6H%P.676329$McHf.348392@fx15.iad> <101u8sb$25g28$1@raubtier-asyl.eternal-september.org> <3FC0Q.931590$G6Lf.397684@fx17.iad> <101v7d7$2cudl$1@raubtier-asyl.eternal-september.org> <CvF0Q.1165311$McHf.1120306@fx15.iad> <101v8ce$2d5it$1@raubtier-asyl.eternal-september.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Date: Fri, 06 Jun 2025 22:04:25 +0200 (CEST) Injection-Info: dont-email.me; posting-host="ff89951cc3a77df748d19f87c958cdc1"; logging-data="2582019"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX183LXG79oNpSstqoE041BAh" User-Agent: Evolution 3.56.2 (3.56.2-1.fc42) Cancel-Lock: sha1:8ipfIre+rDmu4kzcPmTgcneQ3D8= In-Reply-To: <101v8ce$2d5it$1@raubtier-asyl.eternal-september.org> Bytes: 4272 On Fri, 2025-06-06 at 19:26 +0200, Bonita Montero wrote: > Am 06.06.2025 um 19:24 schrieb Scott Lurndal: > > Bonita Montero <Bonita.Montero@gmail.com> writes: > > > Am 06.06.2025 um 16:10 schrieb Scott Lurndal: > > > > Bonita Montero <Bonita.Montero@gmail.com> writes: > > > > > Am 03.06.2025 um 20:25 schrieb Scott Lurndal: > > > >=20 > > > > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 The fchownat() functio= n shall be equivalent to the chown() and lchown() > > > > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 functions except in th= e case where path specifies a relative path. In > > > > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 this case the file to = be changed is determined relative to the directory > > > > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 associated with the fi= le descriptor fd instead of the current working > > > > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 directory. If the acce= ss mode of the open file description associated > > > > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 with the file descript= or is not O_SEARCH, the function shall check > > > > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 whether directory sear= ches are permitted using the current permissions > > > > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 of the directory under= lying the file descriptor. If the access mode is > > > > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 O_SEARCH, the function= shall not perform the check. > > > > > > >=20 > > > > > > > And why is this relevant for directory_iterator or > > > > > > > recursive_directory_iterator ? > > > > > >=20 > > > > > > Why are you asking this question on comp.lang.c? > > > > >=20 > > > > > Because you can have it easier than with opendir() / readdir(). > > > >=20 > > > > Personally, I'd use nftw to iterate over a path. > > > >=20 > > > > https://pubs.opengroup.org/onlinepubs/9799919799/functions/nftw.htm= l > > >=20 > > > That would be much nicer with a lambda which can take the context > > > of the calling function. > > >=20 > >=20 > > That's a matter of opinion. >=20 > It results in much less code.=C2=A0 That is illusion, particularly in this case (about directory). Most serious programs will 'invent' their own functions, even their own 'sugar syntax'... result would be better than 'directory_iterator'. In general, no need for such things as 'directory_iterator' in C-library. > Just like a lambda passed > to std::sort() which takes context of the calling function. >=20 > > In any case, nftw is a C function and C doesn't support lamda functions= .. >=20 > Lambdas without capture can be converted to C function-pointers.