Re: locate - change sizeof(char **) to sizeof(char *)

2014-11-15 Thread Nicolas Bedos
Ted Unangst wrote: > I think using sizeof(*dbv) would be the better idiom. Here's an updated diff, including Tobias Stoeckmann's fix. Index: src/usr.bin/locate/locate/util.c === RCS file: /cvs/src/usr.bin/locate/locate/util.c,v retr

Re: locate - change sizeof(char **) to sizeof(char *)

2014-11-15 Thread Ted Unangst
On Sat, Nov 15, 2014 at 18:42, Nicolas Bedos wrote: > In usr.bin/locate/locate/locate.c and util.c the variable dbv is defined > as a pointer to char * and is used to access the path to every database > provided to locate. E.g. when running > > locate -d /path/to/db1 -d /path/to/db2 -d /path/to/db

Re: locate - change sizeof(char **) to sizeof(char *)

2014-11-15 Thread patrick keshishian
On Sat, Nov 15, 2014 at 10:12:17AM -0800, patrick keshishian wrote: > On Sat, Nov 15, 2014 at 06:42:34PM +0100, Nicolas Bedos wrote: > > In usr.bin/locate/locate/locate.c and util.c the variable dbv is defined > > as a pointer to char * and is used to access the path to every database > > provided

Re: locate - change sizeof(char **) to sizeof(char *)

2014-11-15 Thread Tobias Stoeckmann
On Sat, Nov 15, 2014 at 06:42:34PM +0100, Nicolas Bedos wrote: > dbv = malloc(sizeof(char **)) > > which I believe should be > > dbv = malloc(sizeof(char *)) Correct. While at it, we should also fix the examples in the comment. Tobias Index: util.c ==

Re: locate - change sizeof(char **) to sizeof(char *)

2014-11-15 Thread patrick keshishian
On Sat, Nov 15, 2014 at 06:42:34PM +0100, Nicolas Bedos wrote: > In usr.bin/locate/locate/locate.c and util.c the variable dbv is defined > as a pointer to char * and is used to access the path to every database > provided to locate. E.g. when running > > locate -d /path/to/db1 -d /path/to

locate - change sizeof(char **) to sizeof(char *)

2014-11-15 Thread Nicolas Bedos
In usr.bin/locate/locate/locate.c and util.c the variable dbv is defined as a pointer to char * and is used to access the path to every database provided to locate. E.g. when running locate -d /path/to/db1 -d /path/to/db2 -d /path/to/db3 * *dbv points to '/path/to/db1' *(dbv+1) points