perf tools: Fix bool return value in gzip_is_compressed()
Subsystems (2)
PATCH 1/1 perf tools: Fix bool return value in gzip_is_compressed()
gzip_is_compressed() returns -1 on error but is declared as bool. And -1 gets converted to true, which could be misleading. Return false instead to match the declared type.
--- tools/perf/util/zlib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/zlib.c +1 -1
@@ -88,7 +88,7 @@ bool gzip_is_compressed(const char *input)ssize_t rc;if (fd <0 ) -return -1 ; +return false; rc =read (fd, buf,sizeof (buf));close (fd);
Signature · 1 line
2.39.5 (Apple Git-154)
Quoted 16 lines · Miaoqian Lin
gzip_is_compressed()returns -1 on error but is declared as bool. And -1 gets converted to true, which could be misleading. Return false instead to match the declared type.Fixes 88c74dc76a30 ("perf tools: Add gzip_is_compressed function")Cc <[email protected]>Signed-off-by Miaoqian Lin <[email protected]>--- tools/perf/util/zlib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/util/zlib.c +0
-0
tools/perf/util/zlib.c bool gzip_is_compressed(const char *input) · line 94
Quoted 8 lines
tools/perf/util/zlib.c +1
-1@@ -88,7 +88,7 @@ bool gzip_is_compressed(const char *input)ssize_t rc;if (fd <0 ) -return -1 ; +return false; rc =read (fd, buf,sizeof (buf));close (fd);
Namhyung Kim
maintainerHello,
Quoted 20 lines · Dapeng
Quoted 18 lines · Miaoqian Lin
gzip_is_compressed()returns -1 on error but is declared as bool. And -1 gets converted to true, which could be misleading. Return false instead to match the declared type.Fixes 88c74dc76a30 ("perf tools: Add gzip_is_compressed function")Cc <[email protected]>Signed-off-by Miaoqian Lin <[email protected]>--- tools/perf/util/zlib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/util/zlib.c +0
-0@@ -88,7 +88,7 @@ bool gzip_is_compressed(const char *input)ssize_t rc;
Quoted 8 lines
tools/perf/util/zlib.c bool gzip_is_compressed(const char *input) · line 94
Quoted 6 lines
tools/perf/util/zlib.c +1
-1if (fd <0 ) -return -1 ; +return false; rc =read (fd, buf,sizeof (buf));close (fd);Reviewed-by Dapeng Mi <[email protected]>
We have 43fa1141e2c1af79 ("perf util: Fix compression checks returning -1 as bool").
Thanks,
Namhyung
Quoted 26 lines · Namhyung Kim
Hello,
Quoted 23 lines · Dapeng
Quoted 22 lines · Miaoqian Lin
gzip_is_compressed()returns -1 on error but is declared as bool. And -1 gets converted to true, which could be misleading. Return false instead to match the declared type.Fixes 88c74dc76a30 ("perf tools: Add gzip_is_compressed function")Cc <[email protected]>Signed-off-by Miaoqian Lin <[email protected]>--- tools/perf/util/zlib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/util/zlib.c +1
-1@@ -88,7 +88,7 @@ bool gzip_is_compressed(const char *input)ssize_t rc;if (fd <0 ) -return -1 ; +return false;
Quoted 5 lines
Quoted 3 lines
tools/perf/util/zlib.c bool gzip_is_compressed(const char *input) · line 94
Quoted 2 lines
tools/perf/util/zlib.c +0
-0rc =read (fd, buf,sizeof (buf));close (fd);Reviewed-by Dapeng Mi <[email protected]>We have
43fa1141e2c1af79("perf util: Fix compression checks returning -1 as bool").
Good to know this has been fixed. Thanks. :)
Quoted 4 lines
Thanks,
Namhyung
Quoted 7 lines · Dapeng
tools/perf/util/zlib.c bool gzip_is_compressed(const char *input) · line 89
Quoted 5 lines
+++
b/tools/perf/util/zlib.ctools/perf/util/zlib.c +1
-1@@ -88,7 +88,7 @@ bool gzip_is_compressed(const char *input)if (fd <0 ) -return -1 ; +return false;Reviewed-by Dapeng Mi <[email protected]>
- Arnaldo
Arnaldo Carvalho de Melo
maintainerQuoted 10 lines · Arnaldo Carvalho de Melo
Quoted 7 lines · Dapeng
tools/perf/util/zlib.c bool gzip_is_compressed(const char *input) · line 89
Quoted 5 lines
+++
b/tools/perf/util/zlib.ctools/perf/util/zlib.c +1
-1@@ -88,7 +88,7 @@ bool gzip_is_compressed(const char *input)if (fd <0 ) -return -1 ; +return false;Reviewed-by Dapeng Mi <[email protected]>Reviewed-by Arnaldo Carvalho de Melo <[email protected]>
Sorry for the noise, I merged this already, it is already in 6.18-rc1 :-\
- Arnaldo