From fad2e1d35daaca3af3d6c9fafb76d0f0fe56c938 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Mon, 12 Jan 2004 05:00:46 +0000 Subject: Don't O_TRUNC the dest file, instead use O_EXC and don't do anything if 2004-01-11 Jeffrey Stedfast * em-migrate.c (cp): Don't O_TRUNC the dest file, instead use O_EXC and don't do anything if the dest file already exists (this way we don't re-migrate an mbox or corrupt any summary/ibex/meta files). svn path=/trunk/; revision=24165 --- mail/em-migrate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mail/em-migrate.c') diff --git a/mail/em-migrate.c b/mail/em-migrate.c index 10fc9248cf..b74d55e882 100644 --- a/mail/em-migrate.c +++ b/mail/em-migrate.c @@ -304,7 +304,7 @@ cp (const char *src, const char *dest, gboolean show_progress) if ((fd[0] = open (src, O_RDONLY)) == -1) return -1; - if ((fd[1] = open (dest, O_WRONLY | O_CREAT | O_TRUNC, 0666)) == -1) { + if ((fd[1] = open (dest, O_WRONLY | O_CREAT | O_EXCL, 0666)) == -1) { errnosav = errno; close (fd[0]); errno = errnosav; -- cgit