kselftest: save-and-restore errno to allow for %m formatting
authorAleksa Sarai <cyphar@cyphar.com>
Sat, 20 Jul 2019 00:03:32 +0000 (10:03 +1000)
committerShuah Khan <skhan@linuxfoundation.org>
Tue, 30 Jul 2019 21:46:48 +0000 (15:46 -0600)
commitfc2e634e997d84f2610a482b500865ef2c04fcde
tree55e54ebeb07c4454cd47cbd9e76964fb011b3fb1
parent527d37e9e575bc0e9024de9b499385e7bb31f1ad
kselftest: save-and-restore errno to allow for %m formatting

Previously, using "%m" in a ksft_* format string can result in strange
output because the errno value wasn't saved before calling other libc
functions. The solution is to simply save and restore the errno before
we format the user-supplied format string.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/kselftest.h