=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2008-03-21 15:23:17 +0000
+++ b/sql/sql_parse.cc	2008-06-17 10:08:09 +0000
@@ -7054,11 +7054,17 @@
       thd->thread_stack= (char*) &tmp_thd;
       thd->store_globals();
     }
-    if (thd)
+    
+    if (thd && (acl_reload(thd) || grant_reload(thd)))
     {
-      (void)acl_reload(thd);
-      (void)grant_reload(thd);
+        result= 1;
+        /*
+          When an error is returned, my_message may have not been called and
+          the client will hang waiting for a response.
+        */
+        my_error(ER_UNKNOWN_ERROR, MYF(0), "FLUSH PRIVILEGES failed");
     }
+
     if (tmp_thd)
     {
       delete tmp_thd;
@@ -7094,10 +7100,12 @@
     rotate_relay_log(active_mi);
     pthread_mutex_unlock(&LOCK_active_mi);
 #endif
-    if (ha_flush_logs())
-      result=1;
-    if (flush_error_log())
-      result=1;
+    if (ha_flush_logs() || flush_error_log())
+    {
+      result=1;
+      my_error(ER_UNKNOWN_ERROR,MYF(0),
+               "Failed to flush the log files");
+    }
   }
 #ifdef HAVE_QUERY_CACHE
   if (options & REFRESH_QUERY_CACHE_FREE)
@@ -7144,8 +7152,10 @@
       tmp_write_to_binlog= 0;
       if (lock_global_read_lock(thd))
 	return 1;                               // Killed
-      result=close_cached_tables(thd,(options & REFRESH_FAST) ? 0 : 1,
-                                 tables);
+      if (close_cached_tables(thd,(options & REFRESH_FAST) ? 0 : 1,
+                                 tables))
+          result= 1;
+      
       if (make_global_read_lock_block_commit(thd)) // Killed
       {
         /* Don't leave things in a half-locked state */



