From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cong Ding Subject: [PATCH v2] kvm tools: close opened file Date: Wed, 16 Jan 2013 17:51:44 +0100 Message-ID: <20130116165141.GA18593@gmail.com> References: <1358298456-18377-1-git-send-email-dinggnu@gmail.com> <20130116113522.GR11529@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Pekka Enberg , Sasha Levin , Asias He , kvm@vger.kernel.org, linux-kernel@vger.kernel.org To: Gleb Natapov Return-path: Content-Disposition: inline In-Reply-To: <20130116113522.GR11529@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org The file should be closed before return. Signed-off-by: Cong Ding --- tools/kvm/builtin-setup.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/kvm/builtin-setup.c b/tools/kvm/builtin-setup.c index c5b0566..8b45c56 100644 --- a/tools/kvm/builtin-setup.c +++ b/tools/kvm/builtin-setup.c @@ -159,12 +159,12 @@ static int copy_passwd(const char *guestfs_name) return -1; ret = fprintf(file, "root:x:0:0:root:/root:/bin/sh\n"); - if (ret < 0) - return ret; + if (ret > 0) + ret = 0; fclose(file); - return 0; + return ret; } static int make_guestfs_symlink(const char *guestfs_name, const char *path) -- 1.7.10.4