diff options
author | Rafał Miłecki <rafal@milecki.pl> | 2018-04-13 13:26:14 +0200 |
---|---|---|
committer | Rafał Miłecki <rafal@milecki.pl> | 2018-04-16 19:12:15 +0200 |
commit | 95c07d52c82245fa1f0e5739daf08940a62227c9 (patch) | |
tree | f9bfb71b50ccbae9227418e68fa0fa70edba59b6 /libfstools/libfstools.h | |
parent | 37762ff488752c1686b359816aec75831b49c55f (diff) | |
download | fstools-95c07d52c82245fa1f0e5739daf08940a62227c9.tar.gz |
libfstools: fix foreachdir() to pass dir with a trailing slash
Commit cc63723d886fd ("overlay: use lstat rather than stat and make sure
there are no trailing spaces") changed behavior of foreachdir() breaking
some callbacks. Before that modification all callbacks were getting
directory with a trailing slash. Above commit started removing them.
This broke handle_whiteout() which doesn't work at all since then. It
constructs file paths incorrectly: slash is missing between directory
and a file name. It seems noone noticed it for years because this issue
got hidden by switch2jffs() which also handles whiteouts with its system
command "cp -a" call.
Fix that regression by setting trailing slash back - right after calling
lstat(). Also to keep code simple just skip all entries that aren't
directories. This keeps conditions for removing/setting trailing slash
trivial. A side effect is not calling callbacks for files which is a
free bonus optimization.
Fixes: cc63723d886fd ("overlay: use lstat rather than stat and make sure there are no trailing spaces")
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>
(cherry picked from commit 79721f0376974859f39699a2237dbfa691233523)
Diffstat (limited to 'libfstools/libfstools.h')
0 files changed, 0 insertions, 0 deletions