From fd10dda9983d7d4e1ff6a1e790217b7b58f5afd0 Mon Sep 17 00:00:00 2001
From: Luis Soares <luis.soares@sun.com>
Date: Fri, 5 Feb 2010 17:51:55 +0000
Subject: [PATCH] BUG#50780: 'show binary logs' debug assertion when binary
 logging is disabled

The server would hit an assertion because of a DBUG violation.
There was a missing DBUG_RETURN and instead a plain return
was used.

This patch replaces the return with DBUG_RETURN.
---
 mysql-test/r/no_binlog.result | 2 ++
 mysql-test/t/no_binlog.test   | 4 ++++
 sql/sql_repl.cc               | 2 +-
 3 files changed, 7 insertions(+), 1 deletion(-)
 create mode 100644 mysql-test/r/no_binlog.result
 create mode 100644 mysql-test/t/no_binlog.test

diff --git a/mysql-test/r/no_binlog.result b/mysql-test/r/no_binlog.result
new file mode 100644
index 00000000000..6ae267664fd
--- /dev/null
+++ b/mysql-test/r/no_binlog.result
@@ -0,0 +1,2 @@
+SHOW BINARY LOGS;
+ERROR HY000: You are not using binary logging
diff --git a/mysql-test/t/no_binlog.test b/mysql-test/t/no_binlog.test
new file mode 100644
index 00000000000..628a4ab8351
--- /dev/null
+++ b/mysql-test/t/no_binlog.test
@@ -0,0 +1,4 @@
+# BUG#50780: 'show binary logs' debug assertion when binary logging is disabled
+
+-- error ER_NO_BINARY_LOGGING
+SHOW BINARY LOGS;
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 4b10d284611..ae995ea5ed3 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -1606,7 +1606,7 @@ bool show_binlogs(THD* thd)
   if (!mysql_bin_log.is_open())
   {
     my_message(ER_NO_BINARY_LOGGING, ER(ER_NO_BINARY_LOGGING), MYF(0));
-    return 1;
+    DBUG_RETURN(TRUE);
   }
 
   field_list.push_back(new Item_empty_string("Log_name", 255));
-- 
2.30.9