dovecot: Use nfs_safe_link() instead of link().
dovecot at dovecot.org
dovecot at dovecot.org
Thu Nov 15 16:28:11 EET 2007
details: http://hg.dovecot.org/dovecot/rev/ebe88bc73154
changeset: 6812:ebe88bc73154
user: Timo Sirainen <tss at iki.fi>
date: Thu Nov 15 16:27:53 2007 +0200
description:
Use nfs_safe_link() instead of link().
diffstat:
4 files changed, 4 insertions(+), 5 deletions(-)
src/lib-index/mail-transaction-log-file.c | 2 +-
src/lib-storage/index/dbox/dbox-index.c | 2 +-
src/lib-storage/index/maildir/maildir-copy.c | 2 +-
src/lib/file-dotlock.c | 3 +--
diffs (56 lines):
diff -r 9bc620b934f4 -r ebe88bc73154 src/lib-index/mail-transaction-log-file.c
--- a/src/lib-index/mail-transaction-log-file.c Thu Nov 15 16:27:41 2007 +0200
+++ b/src/lib-index/mail-transaction-log-file.c Thu Nov 15 16:27:53 2007 +0200
@@ -532,7 +532,7 @@ mail_transaction_log_file_create2(struct
path2);
/* try to link() anyway */
}
- if (link(file->filepath, path2) < 0 &&
+ if (nfs_safe_link(file->filepath, path2) < 0 &&
errno != ENOENT && errno != EEXIST) {
mail_index_set_error(index, "link(%s, %s) failed: %m",
file->filepath, path2);
diff -r 9bc620b934f4 -r ebe88bc73154 src/lib-storage/index/dbox/dbox-index.c
--- a/src/lib-storage/index/dbox/dbox-index.c Thu Nov 15 16:27:41 2007 +0200
+++ b/src/lib-storage/index/dbox/dbox-index.c Thu Nov 15 16:27:53 2007 +0200
@@ -611,7 +611,7 @@ static int dbox_index_recreate(struct db
ret = -1;
}
} else {
- if (link(str_c(temp_path), index->path) < 0 &&
+ if (nfs_safe_link(str_c(temp_path), index->path) < 0 &&
errno != EEXIST) {
mail_storage_set_critical(storage,
"link(%s, %s) failed: %m",
diff -r 9bc620b934f4 -r ebe88bc73154 src/lib-storage/index/maildir/maildir-copy.c
--- a/src/lib-storage/index/maildir/maildir-copy.c Thu Nov 15 16:27:41 2007 +0200
+++ b/src/lib-storage/index/maildir/maildir-copy.c Thu Nov 15 16:27:53 2007 +0200
@@ -67,7 +67,7 @@ static int do_hardlink(struct maildir_ma
return ret;
}
- if (link(path, str_c(ctx->dest_path)) < 0) {
+ if (nfs_safe_link(path, str_c(ctx->dest_path)) < 0) {
if (errno == ENOENT)
return 0;
diff -r 9bc620b934f4 -r ebe88bc73154 src/lib/file-dotlock.c
--- a/src/lib/file-dotlock.c Thu Nov 15 16:27:41 2007 +0200
+++ b/src/lib/file-dotlock.c Thu Nov 15 16:27:53 2007 +0200
@@ -342,7 +342,7 @@ static int try_create_lock_hardlink(stru
lock_info->temp_path = str_c(tmp_path);
}
- if (link(lock_info->temp_path, lock_info->lock_path) < 0) {
+ if (nfs_safe_link(lock_info->temp_path, lock_info->lock_path) < 0) {
if (errno == EEXIST)
return 0;
@@ -356,7 +356,6 @@ static int try_create_lock_hardlink(stru
/* non-fatal, continue */
}
lock_info->temp_path = NULL;
-
return 1;
}
More information about the dovecot-cvs
mailing list