From 1b3cef9f3baff371439c8ade6d00e39014241ae7 Mon Sep 17 00:00:00 2001 From: englebass Date: Tue, 2 Sep 2008 05:38:46 +0000 Subject: [PATCH] formatting git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@35791 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/ecore_file/ecore_file.c | 72 ++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/src/lib/ecore_file/ecore_file.c b/src/lib/ecore_file/ecore_file.c index ecb7b51..b458b1d 100644 --- a/src/lib/ecore_file/ecore_file.c +++ b/src/lib/ecore_file/ecore_file.c @@ -311,49 +311,49 @@ ecore_file_mv(const char *src, const char *dst) stat(src, &st); if (S_ISREG(st.st_mode)) { - // Since we can't directly rename, try to - // copy to temp file in the dst directory - // and then rename. - snprintf(buf, sizeof(buf), "%s/.%s.tmp.XXXXXX", - ecore_file_dir_get(dst), - ecore_file_file_get(dst)); - fd = mkstemp(buf); - if(fd < 0) - { - perror("mkstemp"); - goto FAIL; - } - close(fd); - - // Copy to temp file - if(!ecore_file_cp(src,buf)) - goto FAIL; - - // Set file permissions of temp file to match src - chmod(buf, st.st_mode); - - // Try to atomically move temp file to dst - if (rename(buf, dst)) - { - // If we still cannot atomically move - // do a normal copy and hope for the best. - if(!ecore_file_cp(buf, dst)) - goto FAIL; - } - - // Delete temporary file and src - ecore_file_unlink(buf); - ecore_file_unlink(src); - goto PASS; + // Since we can't directly rename, try to + // copy to temp file in the dst directory + // and then rename. + snprintf(buf, sizeof(buf), "%s/.%s.tmp.XXXXXX", + ecore_file_dir_get(dst), + ecore_file_file_get(dst)); + fd = mkstemp(buf); + if (fd < 0) + { + perror("mkstemp"); + goto FAIL; + } + close(fd); + + // Copy to temp file + if (!ecore_file_cp(src, buf)) + goto FAIL; + + // Set file permissions of temp file to match src + chmod(buf, st.st_mode); + + // Try to atomically move temp file to dst + if (rename(buf, dst)) + { + // If we still cannot atomically move + // do a normal copy and hope for the best. + if (!ecore_file_cp(buf, dst)) + goto FAIL; + } + + // Delete temporary file and src + ecore_file_unlink(buf); + ecore_file_unlink(src); + goto PASS; } } goto FAIL; } - PASS: +PASS: return 1; - FAIL: +FAIL: return 0; } -- 2.7.4