From adfba203ffd1bd89d74a63ff09de9b9a40fb64d7 Mon Sep 17 00:00:00 2001
From: unknown <guilhem@gbichot3.local>
Date: Wed, 22 Nov 2006 23:38:10 +0100
Subject: 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
---
 sql/unireg.cc | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

(limited to 'sql/unireg.cc')

diff --git a/sql/unireg.cc b/sql/unireg.cc
index 5c2997c1483..b1d0e75723e 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -285,12 +285,11 @@ bool mysql_create_frm(THD *thd, const char *file_name,
   my_free((gptr) screen_buff,MYF(0));
   my_free((gptr) keybuff, MYF(0));
 
-  if (opt_sync_frm && !(create_info->options & HA_LEX_CREATE_TMP_TABLE))
-  {
-    if (my_sync(file, MYF(MY_WME)))
+  if (opt_sync_frm && !(create_info->options & HA_LEX_CREATE_TMP_TABLE) &&
+      (my_sync(file, MYF(MY_WME)) ||
+       my_sync_dir_by_file(file_name, MYF(MY_WME))))
       goto err2;
-    my_sync_dir_by_file(file_name, MYF(0));
-  }
+
   if (my_close(file,MYF(MY_WME)))
     goto err3;
 
-- 
cgit v1.2.1