aboutsummaryrefslogtreecommitdiff
path: root/lib/memory-notifier-error-inject.c
diff options
context:
space:
mode:
authorJames Clark <[email protected]>2023-07-25 11:58:26 +0100
committerMasahiro Yamada <[email protected]>2023-07-29 15:57:32 +0900
commit238353088e9b28d61f58994aa058d736fc306614 (patch)
treea8acb7ea8d7182bdb4088eb8a0c216d96327d5de /lib/memory-notifier-error-inject.c
parent6eaae198076080886b9e7d57f4ae06fa782f90ef (diff)
scripts/kallsyms: Fix build failure by setting errno before calling getline()
getline() returns -1 at EOF as well as on error. It also doesn't set errno to 0 on success, so initialize it to 0 before using errno to check for an error condition. See the paragraph here [1]: For some system calls and library functions (e.g., getpriority(2)), -1 is a valid return on success. In such cases, a successful return can be distinguished from an error return by setting errno to zero before the call, and then, if the call returns a status that indicates that an error may have occurred, checking to see if errno has a nonzero value. Bear has a bug [2] that launches processes with errno set and causes the following build failure: $ bear -- make LLVM=1 ... LD .tmp_vmlinux.kallsyms1 NM .tmp_vmlinux.kallsyms1.syms KSYMS .tmp_vmlinux.kallsyms1.S read_symbol: Invalid argument [1]: https://linux.die.net/man/3/errno [2]: https://github.com/rizsotto/Bear/issues/469 Fixes: 1c975da56a6f ("scripts/kallsyms: remove KSYM_NAME_LEN_BUFFER") Reviewed-by: Miguel Ojeda <[email protected]> Signed-off-by: James Clark <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]>
Diffstat (limited to 'lib/memory-notifier-error-inject.c')
0 files changed, 0 insertions, 0 deletions