Re: [WIP RFC PATCH v2 5/5] clone: use dir-iterator to avoid explicit dir traversal

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

 



On Thu, Feb 28, 2019 at 12:40 AM Matheus Tavares Bernardino
<matheus.bernardino@xxxxxx> wrote:
> > > @@ -463,7 +460,11 @@ static void copy_or_link_directory(struct strbuf *src, struct strbuf *dest,
> > >                 if (copy_file_with_time(dest->buf, src->buf, 0666))
> > >                         die_errno(_("failed to copy file to '%s'"), dest->buf);
> > >         }
> > > -       closedir(dir);
> > > +
> > > +       if (iter_status != ITER_DONE) {
> > > +               strbuf_setlen(src, src_len);
> > > +               die(_("failed to iterate over '%s'"), src->buf);
> > > +       }
> >
> > I think you need to abort the iterator even when it returns ITER_DONE.
> > At least that's how the first caller in files-backend.c does it.
> >
>
> Hm, I don't think so, since dir_iterator_advance() already frees the
> resources before returning ITER_DONE. Also, I may be wrong, but it
> doesn't seem to me, that files-backend.c does it. The function
> files_reflog_iterator_advance() that calls dir_iterator_advance() even
> sets the dir-iterator pointer to NULL as soon as ITER_DONE is
> returned.

Arghhh.. I read the ref_iterator_abort and thought it was
dir_iterator_abort! Sorry for the noise, too many iterators.
-- 
Duy



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux