shared/utils: systemd-cgls shows 'n/a' when piping output

-1 was used to signal failure, but the type was unsigned.

https://bugs.freedesktop.org/show_bug.cgi?id=56644
This commit is contained in:
Anders Olofsson 2012-11-19 15:25:36 +01:00 committed by Zbigniew Jędrzejewski-Szmek
parent e3657ecd7f
commit 7009eec208
1 changed files with 2 additions and 2 deletions

View File

@ -3803,7 +3803,7 @@ int fd_columns(int fd) {
unsigned columns(void) {
const char *e;
unsigned c;
int c;
if (_likely_(cached_columns > 0))
return cached_columns;
@ -3811,7 +3811,7 @@ unsigned columns(void) {
c = 0;
e = getenv("COLUMNS");
if (e)
safe_atou(e, &c);
safe_atoi(e, &c);
if (c <= 0)
c = fd_columns(STDOUT_FILENO);