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: c95d258d1b ("aco: fix printing ASM on GFX6-7 if clrxdisasm is not found")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5591>
This commit is contained in:
Samuel Pitoiset 2020-06-22 13:33:21 +02:00 committed by Marge Bot
parent e0518800a1
commit 0aca04afa5

View file

@ -69,11 +69,17 @@ void print_asm_gfx6_gfx7(Program *program, std::vector<uint32_t>& 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);
}