/* Copyright (c) 2002-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "nfs-workarounds.h"
#include "fs-api.h"
#include "dbox-save.h"
#include "dbox-attachment.h"
#include "sdbox-storage.h"
#include "sdbox-file.h"
#include "mail-copy.h"
static int
struct sdbox_file *dest_file)
{
int ret;
/* no attachments in source storage */
return 1;
}
dest_storage->attachment_dir) != 0 ||
have to copy the slow way. */
return 0;
}
&extrefs_line)) <= 0)
"Can't copy %s with corrupted extref metadata: %s",
pool_unref(&pool);
return -1;
}
array_count(&extrefs));
ret = 1;
guid_generate(), NULL);
/* we verified above that attachment_fs is compatible for
src and dest, so it doesn't matter which storage's
attachment_fs we use. in any case we need to use the same
one or fs_copy() will crash with assert. */
ret = -1;
} else {
&dest_relpath, 1);
}
} T_END;
pool_unref(&pool);
return ret;
}
static int
{
int ret;
else {
/* Source storage isn't sdbox, can't hard link */
return 0;
}
}
}
if (ret < 0) {
ret = 0;
/* try if the fallback copying code can still
read the file (the mail could still have the
stream open) */
ret = 0;
} else {
}
return ret;
}
(struct sdbox_file *)dest_file);
if (ret <= 0) {
return ret;
}
return 1;
}
{
int ret;
T_BEGIN {
} T_END;
if (ret != 0) {
return ret > 0 ? 0 : -1;
}
/* non-fatal hardlinking failure, try the slow way */
}
}