From 63fd57b95c607d9465eb53ae82533e7e93515c97 Mon Sep 17 00:00:00 2001 From: Cong Ding Date: Wed, 16 Jan 2013 17:51:44 +0100 Subject: [PATCH] kvm tools: close opened file The file should be closed before return. Signed-off-by: Cong Ding Signed-off-by: Pekka Enberg --- builtin-setup.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/builtin-setup.c b/builtin-setup.c index c5b0566..8b45c56 100644 --- a/builtin-setup.c +++ b/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)