Hi!

On Tue, 2016-06-14 at 17:22:07 +0200, Sven Joachim wrote:
> Control: tags -1 + patch

> On 2016-06-14 21:17 +0900, Norbert Preining wrote:
> > Package: dpkg
> > Version: 1.18.7
> > Severity: normal

> > in former times one could do
> >     COLUMNS=200 dpkg -l ...
> > to see eg the full version number. This has gone, although the man page
> > still mentions it.

> It is supposed to work, but due to a bad check it doesn't.  Here is a
> patch that works for me.

Right, checked this when the bug was filed and suspected of the errno
check but had not tested nor produced a patch.

> >From de0f3c1aa5495a961f62fa23aeee08bbfe182e80 Mon Sep 17 00:00:00 2001
> From: Sven Joachim <[email protected]>
> Date: Tue, 14 Jun 2016 17:10:05 +0200
> Subject: [PATCH] dpkg-query: Fix strtol errno check
>
> ---
>  src/querycmd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/querycmd.c b/src/querycmd.c
> index cdc1399..127f0c8 100644
> --- a/src/querycmd.c
> +++ b/src/querycmd.c
> @@ -74,7 +74,7 @@ static int getwidth(void) {
>    if (columns) {
>      errno = 0;
>      res = strtol(columns, &endptr, 10);
> -    if (errno != 0 && columns != endptr && *endptr == '\0' &&
> +    if (errno == 0 && columns != endptr && *endptr == '\0' &&
>          res > 0 && res < INT_MAX)
>        return res;
>    }

Thanks for the patch! I'm merging it for the upcoming 1.18.8 release.

Regards,
Guillem

Reply via email to