On Mon, Jul 05, 2021 at 08:11:12PM -0900, Philip Guenther wrote:
> Based on the fts_open(3) manpage and other base source usage, shouldn't
> this use fts_accpath instead of fts_name?

Yes this should use fts_accpath.  I knew there was something different
than fts_name. I just missed it when I read the man page.
 
> The use of fts_statp in this code seems a bit loose vs ftp_info: instead of
> using S_ISLNK() on fts_statp I would expect this code to check for fts_info
> == FTS_SL: according the manpage fts_statp's value is undefined for various
> values of fts_info.
 
I'll have a look at this. I do agree that the code should be improved
overall.
 
> Philip Guenther
> 
> On Fri, Jul 2, 2021 at 4:46 AM Claudio Jeker <[email protected]>
> wrote:
> 
> > Hit this today while doing some tests. symlink_read() needs to use just
> > the filename and not the full path because fts_read(3) does chdir
> > internally.
> >
> > Without this I got:
> > openrsync: error: ./obj/openrsync.1: readlink: No such file or directory
> > openrsync: error: symlink_read
> > openrsync: error: flist_gen_dirent
> > openrsync: error: flist_gen
> > openrsync: error: rsync_sender
> >
> > --
> > :wq Claudio
> >
> > Index: flist.c
> > ===================================================================
> > RCS file: /cvs/src/usr.bin/rsync/flist.c,v
> > retrieving revision 1.32
> > diff -u -p -r1.32 flist.c
> > --- flist.c     30 Jun 2021 13:10:04 -0000      1.32
> > +++ flist.c     2 Jul 2021 13:14:01 -0000
> > @@ -972,7 +972,7 @@ flist_gen_dirent(struct sess *sess, char
> >                 /* Optionally copy link information. */
> >
> >                 if (S_ISLNK(ent->fts_statp->st_mode)) {
> > -                       f->link = symlink_read(f->path);
> > +                       f->link = symlink_read(ent->fts_name);
> >                         if (f->link == NULL) {
> >                                 ERRX1("symlink_read");
> >                                 goto out;
> >
> >

-- 
:wq Claudio

Reply via email to