diff --git a/client/mysql.cc b/client/mysql.cc
index 81f4b19f7c6444ba7b7fa80965476ca823e3ae60..4fe832a790e822e476a8cad2cfc6d9eeb757ff2d 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -2329,7 +2329,8 @@ com_status(String *buffer __attribute__((unused)),
       (void) mysql_fetch_row(result);		// Read eof
     }
 #ifdef HAVE_OPENSSL
-    if (mysql.net.vio->ssl_ && SSL_get_cipher(mysql.net.vio->ssl_))
+    if (mysql.net.vio && mysql.net.vio->ssl_ &&
+	SSL_get_cipher(mysql.net.vio->ssl_))
       tee_fprintf(stdout, "SSL:\t\t\tCipher in use is %s\n",
 		  SSL_get_cipher(mysql.net.vio->ssl_));
     else
diff --git a/configure.in b/configure.in
index a33ccd4a31150791ebef62cf449f176be5dc68b6..38847b5217e64d295bc8c278b5e7952ca68f3e10 100644
--- a/configure.in
+++ b/configure.in
@@ -1282,12 +1282,12 @@ then
 	AC_MSG_ERROR([On SCO UNIX MySQL must be compiled with gcc. See the Installation chapter in the Reference Manual.]);
       fi
       AC_MSG_RESULT("yes")
-    # Hack for SCO UnixWare 7.1
+    # Hack for SCO UnixWare 7.1.x
     #
     elif test "$with_named_thread" = "no"
     then
       AC_MSG_RESULT("no")
-      AC_MSG_CHECKING("SCO UnixWare 7.1 native threads")
+      AC_MSG_CHECKING("SCO UnixWare 7.1.x native threads")
       if expr "$SYSTEM_TYPE" : ".*sco.*" > /dev/null
       then
         if test -f /usr/lib/libthread.so -o -f /usr/lib/libthreadT.so
@@ -1310,11 +1310,11 @@ then
           AC_MSG_CHECKING("for gcc")
           if expr "$CC" : ".*gcc.*"
           then
-	    CC="$CC -pthread -DUNIXWARE_7";
-	    CXX="$CXX -pthread -DUNIXWARE_7";
+	    CC="$CC -pthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
+	    CXX="$CXX -pthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
           else
-	    CC="$CC -Kthread -DUNIXWARE_7";
-	    CXX="$CXX -Kthread -DUNIXWARE_7";
+	    CC="$CC -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
+	    CXX="$CXX -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
           fi
         else
           { echo "configure: error: Can't find thread libs on SCO UnixWare7. See the Installation chapter in the Reference Manual." 1>&2; exit 1; };
@@ -1350,10 +1350,11 @@ then
       AC_MSG_CHECKING("for gcc")
       if expr "$CC" : ".*gcc.*"
       then
-	{ echo "configure: error: On SCO UnixWare7 MySQL must be compiled with cc. See the Installation chapter in the Reference Manual." 1>&2; exit 1; };
+	CC="$CC -pthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
+	CXX="$CXX -pthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
       else
-	CC="$CC -Kthread -DUNIXWARE_7";
-	CXX="$CXX -Kthread -DUNIXWARE_7";
+	CC="$CC -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
+	CXX="$CXX -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
       fi
       AC_MSG_RESULT("yes")
     else
@@ -1385,7 +1386,8 @@ then
       AC_MSG_CHECKING("for gcc")
       if expr "$CC" : ".*gcc.*"
       then
-	{ echo "configure: error: On OpenUNIX8 and UnixWare7 MySQL must be compiled with cc. See the Installation chapter in the Reference Manual." 1>&2; exit 1; };
+	CC="$CC -pthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
+	CXX="$CXX -pthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
       else
  	CC="$CC -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
  	CXX="$CXX -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
diff --git a/include/my_global.h b/include/my_global.h
index 5ad12fc1f150038afb4d7f6b15f2c0b1438bb261..9d08977a7cdf9874edd1d079017038f62c852e66 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -149,10 +149,6 @@ double my_ulonglong2double(unsigned long long A);
 C_MODE_END
 #endif /* _AIX */
 
-#ifdef UNIXWARE_7
-#define pthread_attr_setstacksize(A,B)	/* setting stack breaks things */
-#endif
-
 #ifdef HAVE_BROKEN_SNPRINTF	/* HPUX 10.20 don't have this defined */
 #undef HAVE_SNPRINTF
 #endif
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 14680306e5d128ba4353704e25ecec1779e18cb5..ce23abb6b2c823ffca607468a5c6c726c8506bbd 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -59,6 +59,7 @@ char* query_table_status(THD *thd,const char *db,const char *table_name);
 
 #define ACL_CACHE_SIZE		256
 #define HASH_PASSWORD_LENGTH	16
+#define MAX_PASSWORD_LENGTH	32
 #define HOST_CACHE_SIZE		128
 #define MAX_ACCEPT_RETRY	10	// Test accept this many times
 #define MAX_FIELDS_BEFORE_HASH	32
diff --git a/sql/slave.h b/sql/slave.h
index 6a73c86d30420609ec60ddef8894b3f5fd7fea53..cae8c6ae24139fa37ca98f451fbd859fe73ae647 100644
--- a/sql/slave.h
+++ b/sql/slave.h
@@ -250,20 +250,20 @@ Log_event* next_event(RELAY_LOG_INFO* rli);
 typedef struct st_master_info
 {
   char master_log_name[FN_REFLEN];
+  char host[HOSTNAME_LENGTH+1];
+  char user[USERNAME_LENGTH+1];
+  char password[MAX_PASSWORD_LENGTH+1];
   
   my_off_t master_log_pos;
   File fd; // we keep the file open, so we need to remember the file pointer
   IO_CACHE file;
   
   /* the variables below are needed because we can change masters on the fly */
-  char host[HOSTNAME_LENGTH+1];
-  char user[USERNAME_LENGTH+1];
-  char password[HASH_PASSWORD_LENGTH+1];
   pthread_mutex_t data_lock,run_lock;
   pthread_cond_t data_cond,start_cond,stop_cond;
   THD *io_thd;
   MYSQL* mysql;
-  uint32 file_id; /* for 3.23 load data infile */
+  uint32 file_id;				/* for 3.23 load data infile */
   RELAY_LOG_INFO rli;
   uint port;
   uint connect_retry;
@@ -271,12 +271,11 @@ typedef struct st_master_info
   int events_till_abort;
 #endif
   bool inited;
-  enum enum_binlog_formats old_format;			/* master binlog is in 3.23 format */
+  enum enum_binlog_formats old_format;		/* binlog is in 3.23 format */
   volatile bool abort_slave, slave_running;
   volatile ulong slave_run_id;
   bool ignore_stop_event;
   
-  
   st_master_info()
     :fd(-1), io_thd(0), inited(0), old_format(BINLOG_FORMAT_CURRENT),
      abort_slave(0),slave_running(0), slave_run_id(0)
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 8fb82798a4585fa97df7e731e7f4d3395ae45ccc..e775a5d712eecdeaec40c75260ec82cf726971df 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -267,9 +267,13 @@ int purge_master_logs(THD* thd, const char* to_log)
 {
   char search_file_name[FN_REFLEN];
   const char* errmsg = 0;
+  int res;
+
+  if (!mysql_bin_log.is_open())
+    goto end;
 
   mysql_bin_log.make_log_name(search_file_name, to_log);
-  int res = mysql_bin_log.purge_logs(thd, search_file_name);
+  res = mysql_bin_log.purge_logs(thd, search_file_name);
 
   switch(res)  {
   case 0: break;
@@ -292,9 +296,9 @@ binlog purge"; break;
     send_error(&thd->net, 0, errmsg);
     return 1;
   }
-  else
-    send_ok(&thd->net);
 
+end:
+  send_ok(&thd->net);
   return 0;
 }
 
@@ -886,7 +890,7 @@ int change_master(THD* thd, MASTER_INFO* mi)
 
   if (lex_mi->log_file_name)
     strmake(mi->master_log_name, lex_mi->log_file_name,
-	    sizeof(mi->master_log_name));
+	    sizeof(mi->master_log_name)-1);
   if (lex_mi->pos)
   {
     mi->master_log_pos= lex_mi->pos;
@@ -895,11 +899,11 @@ int change_master(THD* thd, MASTER_INFO* mi)
   DBUG_PRINT("info", ("master_log_pos: %d", (ulong) mi->master_log_pos));
 
   if (lex_mi->host)
-    strmake(mi->host, lex_mi->host, sizeof(mi->host));
+    strmake(mi->host, lex_mi->host, sizeof(mi->host)-1);
   if (lex_mi->user)
-    strmake(mi->user, lex_mi->user, sizeof(mi->user));
+    strmake(mi->user, lex_mi->user, sizeof(mi->user)-1);
   if (lex_mi->password)
-    strmake(mi->password, lex_mi->password, sizeof(mi->password));
+    strmake(mi->password, lex_mi->password, sizeof(mi->password)-1);
   if (lex_mi->port)
     mi->port = lex_mi->port;
   if (lex_mi->connect_retry)
@@ -1137,7 +1141,6 @@ int show_binlog_info(THD* thd)
 
 int show_binlogs(THD* thd)
 {
-  const char *errmsg;
   IO_CACHE *index_file;
   char fname[FN_REFLEN];
   NET* net = &thd->net;
@@ -1148,8 +1151,8 @@ int show_binlogs(THD* thd)
   if (!mysql_bin_log.is_open())
   {
     //TODO:  Replace with ER() error message
-    errmsg= "You are not using binary logging";
-    goto err_with_msg;
+    send_error(net, 0, "You are not using binary logging");
+    return 1;
   }
 
   field_list.push_back(new Item_empty_string("Log_name", 255));
@@ -1174,8 +1177,6 @@ int show_binlogs(THD* thd)
   send_eof(net);
   return 0;
 
-err_with_msg:
-  send_error(net, 0, errmsg);
 err:
   mysql_bin_log.unlock_index();
   return 1;
diff --git a/sql/sql_repl.h b/sql/sql_repl.h
index 15435382b080ed21b7d4ea9ccf87ffaf84027848..c73744c4b7c7ea13d4ee8b7d178cea4494f84650 100644
--- a/sql/sql_repl.h
+++ b/sql/sql_repl.h
@@ -6,7 +6,7 @@ typedef struct st_slave_info
   uint32 rpl_recovery_rank, master_id;
   char host[HOSTNAME_LENGTH+1];
   char user[USERNAME_LENGTH+1];
-  char password[HASH_PASSWORD_LENGTH+1];
+  char password[MAX_PASSWORD_LENGTH+1];
   uint16 port;
   THD* thd;
 } SLAVE_INFO;
diff --git a/strings/strmake.c b/strings/strmake.c
index 2e384fc168abe16026a41bc108377eaf08509d6e..d2252f648f6f9a2e29c42362f7397e400b413c19 100644
--- a/strings/strmake.c
+++ b/strings/strmake.c
@@ -21,7 +21,7 @@
 
     strmake(dst,src,length) moves length characters, or until end, of src to
     dst and appends a closing NUL to dst.
-    Note that is strlen(src) >= length then dst[length] will be set to \0
+    Note that if strlen(src) >= length then dst[length] will be set to \0
     strmake() returns pointer to closing null
 */