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
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
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
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
==
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
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