Skip to content

Commit

Permalink
fs: explicitly compare isatty() result
Browse files Browse the repository at this point in the history
Reportedly, automatic conversion of the `isatty()` int result value to
a bool does not work correctly on PPC. Explicitly compare the result
value with `1` to infer the boolean result value.

Fixes: #165
Signed-off-by: Jo-Philipp Wich <[email protected]>
  • Loading branch information
jow- committed Jul 25, 2023
1 parent 08c2ae2 commit f459166
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ uc_fs_isatty(uc_vm_t *vm, size_t nargs)
if (fd == -1)
err_return(errno);

return ucv_boolean_new(isatty(fd));
return ucv_boolean_new(isatty(fd) == 1);
}

/**
Expand Down

0 comments on commit f459166

Please sign in to comment.