From fec3fd1f8ac1db9ed87b79bd3eb5e38aa835e881 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 26 Jul 2014 13:30:40 -0500 Subject: Move DIRTREE_COMEAGAIN second callback up to when the filehandle is still open, and add dir->again variable to distinguish second call instead of checking for -1 filehandle. --- toys/other/switch_root.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'toys/other/switch_root.c') diff --git a/toys/other/switch_root.c b/toys/other/switch_root.c index 1dfa20de..0861c70e 100644 --- a/toys/other/switch_root.c +++ b/toys/other/switch_root.c @@ -32,7 +32,7 @@ static int del_node(struct dirtree *node) if (node->st.st_dev == TT.rootdev && dirtree_notdotdot(node)) { int flag = 0; if (S_ISDIR(node->st.st_mode)) { - if (node->data != -1) return DIRTREE_COMEAGAIN; + if (!node->again) return DIRTREE_COMEAGAIN; flag = AT_REMOVEDIR; } unlinkat(dirtree_parentfd(node), node->name, flag); -- cgit v1.2.3