]> git.ipfire.org Git - thirdparty/systemd.git/commit - TODO
shared/kbd-util: fix return value confusion with nftw()
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 4 Mar 2021 09:42:53 +0000 (10:42 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 4 Mar 2021 10:44:07 +0000 (11:44 +0100)
commit3864b4b038b4c8213cbe0ed60281217c37e0a426
tree58709f52fe806dd588d2bc2a952721a378d1e27a
parent315edc2c115a28e9a9463ad5e914610ce893e170
shared/kbd-util: fix return value confusion with nftw()

We would return a real error sometimes from the callback, and FTW_STOP other
times. Because of FTW_ACTIONRETVAL, everything except FTW_STOP would be
ignored. I don't think using FTW_ACTIONRETVAL is useful.

nftw() can only be used meaningfully with errno. Even if we return a proper
value ourselves from the callback, it will be propagated as a return value from
nftw(), but there is no way to distinguish this from a value generated by
nftw() itself, which is -1/-EPERM on error. So let's set errno ourselves so the
caller can at least look at that.

The code still ignores all errors.
TODO
src/shared/kbd-util.c