From b3fe89ecf60c8beb7778490f50425625b6c4744d Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Thu, 15 Jan 2004 18:55:10 +0000 Subject: Only abort the copy if the dest folder both exists and contains data. 2004-01-15 Jeffrey Stedfast * em-migrate.c (cp): Only abort the copy if the dest folder both exists and contains data. Fixes bug #52880. svn path=/trunk/; revision=24250 --- mail/ChangeLog | 5 +++++ mail/em-migrate.c | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index 201f5595ab..2c4d09c427 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,8 @@ +2004-01-15 Jeffrey Stedfast + + * em-migrate.c (cp): Only abort the copy if the dest folder both + exists and contains data. Fixes bug #52880. + 2004-01-15 Rodrigo Moya * em-folder-browser.c: removed ForgetPasswords verb. diff --git a/mail/em-migrate.c b/mail/em-migrate.c index 4bc72e79dc..ccb4fedfe3 100644 --- a/mail/em-migrate.c +++ b/mail/em-migrate.c @@ -1243,7 +1243,9 @@ cp (const char *src, const char *dest, gboolean show_progress) size_t total = 0; struct stat st; - if (stat (src, &st) == -1) + /* if the dest file exists and has content, abort - we don't + * want to corrupt their existing data */ + if (stat (dest, &st) != -1 || st.st_size > 0) return -1; if ((fd[0] = open (src, O_RDONLY)) == -1) -- cgit v1.2.3