Return-path: Received: from mx1.redhat.com ([209.132.183.28]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XJf4X-0003ue-Av for kexec@lists.infradead.org; Tue, 19 Aug 2014 08:47:17 +0000 From: Baoquan He Subject: [PATCH] kexec: usage printing when specify "-u -p" Date: Tue, 19 Aug 2014 16:45:26 +0800 Message-Id: <1408437926-2462-1-git-send-email-bhe@redhat.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "kexec" Errors-To: kexec-bounces+dwmw2=infradead.org@lists.infradead.org To: kexec@lists.infradead.org, horms@verge.net.au Cc: Baoquan He Currently, unload work will be done successfully when specify "kexec -p -u". However, when exchange the sequence like "kexec -u -p" unload work can be done too, but with a usage printing. This is because in the former sequence, "-p" will do below assignments: do_load=0; do_unload=1; Then "-u" do below assignments. do_load=0; do_unload=1; Nothing wrong happened in this situation. Since the result woule be: "do_load==0" and do_unload==1. In the latter sequence, the final result will be "do_load==1" and "do_unload==1". Then after unload operation, it will go into loading code flow. Thsi cause the usage() calling and printing. So in this patch add a check when enter into the loading code flow. Signed-off-by: Baoquan He --- kexec/kexec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kexec/kexec.c b/kexec/kexec.c index 7e7b604..87ec26a 100644 --- a/kexec/kexec.c +++ b/kexec/kexec.c @@ -1361,7 +1361,7 @@ int main(int argc, char *argv[]) else result = k_unload(kexec_flags); } - if (do_load && (result == 0)) { + if (do_load && !do_unload (result == 0)) { if (do_kexec_file_syscall) result = do_kexec_file_load(fileind, argc, argv, kexec_file_flags); -- 1.8.5.3 _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec