Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 01 Mar 2001 15:35:08 +0200
From:      Maxim Sobolev <sobomax@FreeBSD.org>
To:        Garrett Rooney <rooneg@electricjellyfish.net>
Cc:        ports@FreeBSD.org, jhk@FreeBSD.org, gad@FreeBSD.org, reg@FreeBSD.org
Subject:   Re: [patch] which package functionality for pkg_info
Message-ID:  <3A9E500C.4709EB8@FreeBSD.org>
References:  <20010225161633.C94657@electricjellyfish.net> <200102252125.f1PLPH132145@vic.sabbo.net> <20010225192632.C37487@electricjellyfish.net> <20010225200351.A48200@electricjellyfish.net> <3A99FC4E.B825CB6B@FreeBSD.org> <20010227220553.A75036@electricjellyfish.net> <20010228192345.A11065@electricjellyfish.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Garrett Rooney wrote:

> so here's a revised patch, yet again ;-)
>
> this takes into account Maxim's latest changes, and cleans up one or two
> things i noticed.
>
> also, Maxim's last commit removed these lines from perform.c:
>
>         tmp = getenv(PKG_DBDIR);
>         if (!tmp)
>                 tmp = DEF_LOG_DIR;
>
> without those, -e was broken, as it would try to use tmp to construct a path
> when tmp was initialized to NULL.

OOPS, you are right. I'll put them back immediately.

I have several additional comments regarding your patches:

1. There are several places in your patches when you use the following:
errx(2, strerror(errno));
which is wrong from the two points of view:
- you should avoid supplying return value of a function as a format string for
printf()-like function. The following would be more correct:
foo("%s", bar());
- in this particular case you can use err() function, which automatically expands
errno value into error message and prints it to the stderr, i.e.
err(2, NULL);

2. Use ordinary malloc(...) instead of calloc(1, ...);

3. The following code is wrong, because it allocates 4 times more memory than
required (sizeof(char *) == 4, not 1).
fixed_path = calloc(strlen(cwd) + strlen(current) + 2, sizeof(char *));

4. I suspect that the horrible 10-level fts(3) loop could be greatly simplified by
using matchinstalled(MATCH_ALL, ...) function. Please try to look into that
direction.

-Maxim


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3A9E500C.4709EB8>