[sheepdog] [PATCH 05/10] sheep/migrate: clear performance tips generated by cppcheck

Ruoyu liangry at ucweb.com
Tue Sep 2 11:14:08 CEST 2014


This patch gets rid of the below message while performing a code
analysis with cppcheck.

[sheep/migrate.c:117] -> [sheep/migrate.c:122]: (performance) Variable
'fd' is reassigned a value before the old one has been used.

Signed-off-by: Ruoyu <liangry at ucweb.com>
---
 sheep/migrate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sheep/migrate.c b/sheep/migrate.c
index 81c4de7..f01eaf6 100644
--- a/sheep/migrate.c
+++ b/sheep/migrate.c
@@ -114,7 +114,7 @@ static void for_each_epoch(int (*func)(uint32_t epoch))
 static int backup_file(char *fname, char *suffix)
 {
 	char dst_file[PATH_MAX];
-	int fd = -1, ret = -1, len;
+	int fd, ret = -1, len;
 	void *buf = NULL;
 
 	snprintf(dst_file, sizeof(dst_file), "%s.%s", fname, suffix);
-- 
1.8.3.2





More information about the sheepdog mailing list