summaryrefslogtreecommitdiff
path: root/mysys/my_rename.c
diff options
context:
space:
mode:
authorunknown <guilhem@gbichot3.local>2006-11-22 23:38:10 +0100
committerunknown <guilhem@gbichot3.local>2006-11-22 23:38:10 +0100
commitadfba203ffd1bd89d74a63ff09de9b9a40fb64d7 (patch)
treed5d39cc2b29dd80e4a72a2396c69060fd658d4ce /mysys/my_rename.c
parent331952660c7ab170cb55320aa97e0e04dfd29470 (diff)
downloadmariadb-git-adfba203ffd1bd89d74a63ff09de9b9a40fb64d7.tar.gz
Maria - post-review fixes about my_sync_dir():
make it return an error (except if certain errno), test this error in callers. Do a single my_sync_dir() in my_rename() if possible. include/my_global.h: better have a symbol name talking about the feature, use it in the code of the feature, and define the symbol once depending on the platform, rather than have the platform "tested" in the code of the feature several times. include/my_sys.h: my_sync_dir() now can return error mysys/my_create.c: my_sync_dir() can now return an error mysys/my_delete.c: my_sync_dir() can now return an error mysys/my_rename.c: my_sync_dir() can now return an error. Do a single sync if "from" and "to" are the same directory. #ifdef here to not even compile dirname_part() if useless. mysys/my_sync.c: more comments. A compilation error if no way to make my_sync() work (I guess we don't want to ship a binary which cannot do any sync at all; users of strange OSes compile from source and can remove the #error). my_sync_dir() now returns an error (except for certain errno values considered ok; EIO "input/output error" is not ok). sql/unireg.cc: my_sync_dir() now returns an error which must be tested
Diffstat (limited to 'mysys/my_rename.c')
-rw-r--r--mysys/my_rename.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/mysys/my_rename.c b/mysys/my_rename.c
index 2c9ace6223a..8c2a354324b 100644
--- a/mysys/my_rename.c
+++ b/mysys/my_rename.c
@@ -63,8 +63,16 @@ int my_rename(const char *from, const char *to, myf MyFlags)
}
else if (MyFlags & MY_SYNC_DIR)
{
- my_sync_dir_by_file(from, MyFlags);
- my_sync_dir_by_file(to, MyFlags);
+#ifdef NEED_EXPLICIT_SYNC_DIR
+ /* do only the needed amount of syncs: */
+ char dir_from[FN_REFLEN], dir_to[FN_REFLEN];
+ dirname_part(dir_from, from);
+ dirname_part(dir_to, to);
+ if (my_sync_dir(dir_from, MyFlags) ||
+ (strcmp(dir_from, dir_to) &&
+ my_sync_dir(dir_to, MyFlags)))
+ error= -1;
+#endif
}
DBUG_RETURN(error);
} /* my_rename */