aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-migrate.c
diff options
context:
space:
mode:
Diffstat (limited to 'mail/em-migrate.c')
-rw-r--r--mail/em-migrate.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/mail/em-migrate.c b/mail/em-migrate.c
index f7610b7e27..26c3c9c566 100644
--- a/mail/em-migrate.c
+++ b/mail/em-migrate.c
@@ -1248,10 +1248,13 @@ cp (const char *src, const char *dest, gboolean show_progress)
if (stat (dest, &st) == 0 && st.st_size > 0)
return -1;
+ if (stat (src, &st) == -1)
+ return -1;
+
if ((fd[0] = open (src, O_RDONLY)) == -1)
return -1;
- if ((fd[1] = open (dest, O_WRONLY | O_CREAT, 0666)) == -1) {
+ if ((fd[1] = open (dest, O_WRONLY | O_CREAT | O_TRUNC, 0666)) == -1) {
errnosav = errno;
close (fd[0]);
errno = errnosav;