lkml.org 
[lkml]   [2013]   [Jan]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH v2] kvm tools: close opened file
The file should be closed before return.

Signed-off-by: Cong Ding <dinggnu@gmail.com>
---
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


\
 
 \ /
  Last update: 2013-01-16 18:43    [W:0.062 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site