From e5c1c6a96b2486aae9998323d04a6d3e329f1bf6 Mon Sep 17 00:00:00 2001 From: YarBor Date: Mon, 26 Feb 2024 22:20:25 +0800 Subject: [PATCH] =?UTF-8?q?criu:=20fix=20tempdir=20recycle=20:=20Fixes:=20?= =?UTF-8?q?#2351=20When=20many=20du=E1=B8=BFps=20failed=20in=20#2348,=20it?= =?UTF-8?q?=20created=20a=20bunch=20of=20empty=20directories?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ```txt drwx------ 2 root root 4096 Feb 12 23:48 .criu.temp-aa-policy.8uhTbO drwx------ 2 root root 4096 Feb 12 23:51 .criu.temp-aa-policy.90Vqt9 drwx------ 2 root root 4096 Feb 12 23:29 .criu.temp-aa-policy.9an3IS drwx------ 2 root root 4096 Feb 12 23:51 .criu.temp-aa-policy.CBz1ud drwx------ 2 root root 4096 Feb 12 23:39 .criu.temp-aa-policy.eA0Kj6 drwx------ 2 root root 4096 Feb 12 23:34 .criu.temp-aa-policy.GD04gM drwx------ 2 root root 4096 Feb 12 23:38 .criu.temp-aa-policy.ItnOKf drwx------ 2 root root 4096 Feb 12 23:57 .criu.temp-aa-policy.NuRSjL drwx------ 2 root root 4096 Feb 12 23:57 .criu.temp-aa-policy.nUX8Kq drwx------ 2 root root 4096 Feb 12 23:36 .criu.temp-aa-policy.PGi24L drwx------ 2 root root 4096 Feb 12 23:35 .criu.temp-aa-policy.QNuwGp drwx------ 2 root root 4096 Feb 12 23:28 .criu.temp-aa-policy.RyvBPt drwx------ 2 root root 4096 Feb 12 23:41 .criu.temp-aa-policy.TXQpQv drwx------ 2 root root 4096 Feb 12 23:41 .criu.temp-aa-policy.URYvi0 drwx------ 2 root root 4096 Feb 12 23:34 .criu.temp-aa-policy.VJixh8 drwx------ 2 root root 4096 Feb 12 23:48 .criu.temp-aa-policy.whT8gi ``` delete the directories after aborting Signed-off-by: YarBor --- criu/apparmor.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/criu/apparmor.c b/criu/apparmor.c index e46e239f59..84828e1f1c 100644 --- a/criu/apparmor.c +++ b/criu/apparmor.c @@ -622,13 +622,14 @@ static int do_suspend(bool suspend) int suspend_aa(void) { int ret; - if (!mkdtemp(policydir)) { + char *tempdirname; + if (!(tempdirname = mkdtemp(policydir))) { pr_perror("failed to make AA policy dir"); return -1; } ret = do_suspend(true); - if (rmrf(policydir) < 0) + if (rmrf(tempdirname) < 0) pr_err("failed removing policy dir %s\n", policydir); return ret;