From 04fe80b49802a0505eb62331dbcd324bb9b537c7 Mon Sep 17 00:00:00 2001 From: o9000 Date: Sun, 12 Jul 2015 17:01:20 +0200 Subject: [PATCH] copy_file(): prevent truncating file if src == dest --- src/util/common.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/util/common.c b/src/util/common.c index 62f88c2..552aa3b 100644 --- a/src/util/common.c +++ b/src/util/common.c @@ -35,6 +35,9 @@ void copy_file(const char *pathSrc, const char *pathDest) { + if (g_str_equal(pathSrc, pathDest)) + return; + FILE *fileSrc, *fileDest; char buffer[100]; int nb;