From: Samuel Pitoiset Date: Mon, 22 Jun 2020 11:33:21 +0000 (+0200) Subject: aco: fix printing ASM on GFX6-7 again X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0aca04afa585e87bc900fb3b9c19c92d78b3e8f7;p=mesa.git aco: fix printing ASM on GFX6-7 again Checking errno is actually wrong because it's only updated if popen() fails (ie. NULL). One solution is to check if the first line is empty. Fixes: c95d258d1bc ("aco: fix printing ASM on GFX6-7 if clrxdisasm is not found") Signed-off-by: Samuel Pitoiset Reviewed-by: Daniel Schürmann Part-of: --- diff --git a/src/amd/compiler/aco_print_asm.cpp b/src/amd/compiler/aco_print_asm.cpp index 2e6519fe57b..d4b0e0edbcf 100644 --- a/src/amd/compiler/aco_print_asm.cpp +++ b/src/amd/compiler/aco_print_asm.cpp @@ -69,11 +69,17 @@ void print_asm_gfx6_gfx7(Program *program, std::vector& binary, sprintf(command, "clrxdisasm --gpuType=%s -r %s", gpu_type, path); p = popen(command, "r"); - if (!p || errno == ENOENT) { - out << "clrxdisasm not found\n"; - } else { - while (fgets(line, sizeof(line), p)) + if (p) { + if (!fgets(line, sizeof(line), p)) { + out << "clrxdisasm not found\n"; + pclose(p); + goto fail; + } + + do { out << line; + } while (fgets(line, sizeof(line), p)); + pclose(p); }