NetBSD-Bugs archive

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

Re: bin/51039: makemandb(8): Check for return value of chdir(2)



On Sun, Apr 03, 2016 at 03:05:01PM +0000, Abhinav Upadhyay wrote:
> The following reply was made to PR bin/51039; it has been noted by GNATS.
> 
> From: Abhinav Upadhyay <er.abhinav.upadhyay%gmail.com@localhost>
> To: NetBSD GNATS <gnats-bugs%netbsd.org@localhost>
> Cc: gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost
> Subject: Re: bin/51039: makemandb(8): Check for return value of chdir(2)
> Date: Sun, 3 Apr 2016 20:33:32 +0530
> 
>  On Sun, Apr 3, 2016 at 6:30 PM, Joerg Sonnenberger
>  <joerg%britannica.bec.de@localhost> wrote:
>  > The following reply was made to PR bin/51039; it has been noted by GNATS.
>  >
>  > From: Joerg Sonnenberger <joerg%britannica.bec.de@localhost>
>  > To: gnats-bugs%NetBSD.org@localhost
>  > Cc:
>  > Subject: Re: bin/51039: makemandb(8): Check for return value of chdir(2)
>  > Date: Sun, 3 Apr 2016 14:56:09 +0200
>  >
>  >  On Sun, Apr 03, 2016 at 12:10:00AM +0000, er.abhinav.upadhyay%gmail.com@localhost wrote:
>  >  > makemandb makes a call to chdir(2) before parsing each page but the
>  >  > return value of chdir is not checked. We should check the return status
>  >  > and handle the error.
>  >
>  >  Actually, it would be better to just keep the parent directory open and
>  >  use fchdir.
>  >
>  
>  You mean keeping a set of file descriptors open for each of the parent
>  directories, so that instead of doing chdir each time, we use the
>  already open fds for doing fchdir, and close the open fds once we are
>  done doing all the parsing?

Sure, the hierachy is supposed to flat (i.e. two levels under man/ at
most), and you only need the directory open while parsing a file in that
subtree.

Joerg


Home | Main Index | Thread Index | Old Index