From 5a999ef68c721b7aa4bafc41682947b07d91710f Mon Sep 17 00:00:00 2001 From: Josh Poimboeuf Date: Tue, 1 Apr 2014 07:51:21 -0500 Subject: [PATCH] kpatch-build: create applied-patch only after verifying patch Create the applied-patch file only after the patch has been verified. Otherwise if you accidentally supply a patch which had already been applied to the source, the cleanup trap won't reverse apply it when exiting the script. --- kpatch-build/kpatch-build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build index 5f531ef..5d02b40 100755 --- a/kpatch-build/kpatch-build +++ b/kpatch-build/kpatch-build @@ -184,8 +184,8 @@ fi echo "Testing patch file" cd "$SRCDIR" || die +patch -N -p1 < "$PATCHFILE" || die "source patch file failed to apply" cp "$PATCHFILE" "$APPLIEDPATCHFILE" || die -patch -N -p1 < "$APPLIEDPATCHFILE" || die "source patch file failed to apply" patch -p1 -R < "$APPLIEDPATCHFILE" &> /dev/null || die "reverse patch apply failed" echo "Building original kernel"