diff src/lib/file-copy.c @ 6940:414c9d631a81 HEAD

Replaced t_push/t_pop calls with T_FRAME*() macros.
author Timo Sirainen <tss@iki.fi>
date Wed, 05 Dec 2007 17:47:44 +0200
parents 03af6da2ace1
children 7ed926ed7aa4
line wrap: on
line diff
--- a/src/lib/file-copy.c	Wed Dec 05 17:47:19 2007 +0200
+++ b/src/lib/file-copy.c	Wed Dec 05 17:47:44 2007 +0200
@@ -93,22 +93,23 @@
 
 int file_copy(const char *srcpath, const char *destpath, bool try_hardlink)
 {
-	const char *tmppath;
 	int ret;
 
-	t_push();
-	tmppath = t_strconcat(destpath, ".tmp", NULL);
+	T_FRAME(
+		const char *tmppath;
+
+		tmppath = t_strconcat(destpath, ".tmp", NULL);
 
-	ret = file_copy_to_tmp(srcpath, tmppath, try_hardlink);
-	if (ret > 0) {
-		if (rename(tmppath, destpath) < 0) {
-			i_error("rename(%s, %s) failed: %m", tmppath, destpath);
-			ret = -1;
+		ret = file_copy_to_tmp(srcpath, tmppath, try_hardlink);
+		if (ret > 0) {
+			if (rename(tmppath, destpath) < 0) {
+				i_error("rename(%s, %s) failed: %m",
+					tmppath, destpath);
+				ret = -1;
+			}
 		}
-	}
-	if (ret < 0)
-		(void)unlink(tmppath);
-
-	t_pop();
+		if (ret < 0)
+			(void)unlink(tmppath);
+	);
 	return ret;
 }