diff --git a/client/mysqltest.c b/client/mysqltest.c
index d898bc1d7c886ff9834a9757059978aa7b6baa2b..e380ffeb3392ba1175b8b3f92de72ea05809552d 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -60,6 +60,11 @@
 # endif
 #endif
 
+/* Use cygwin for --exec and --system before 5.0 */
+#if MYSQL_VERSION_ID < 50000
+#define USE_CYGWIN
+#endif
+
 #define MAX_VAR_NAME_LENGTH    256
 #define MAX_COLUMNS            256
 #define MAX_EMBEDDED_SERVER_ARGS 64
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 44c7c6b83caf413f6b25d38b1d4ea36e7d702ad9..4f1269cb35195a19326234d94a614813bcb3dc68 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -1713,7 +1713,7 @@ sub environment_setup () {
   my $deb_version;
   if (  $opt_valgrind and -d $debug_libraries_path and
         (! -e '/etc/debian_version' or
-         ($deb_version= mtr_grab_file('/etc/debian_version')) == 0 or
+	 ($deb_version= mtr_grab_file('/etc/debian_version')) !~ /^[0-9]+\.[0-9]$/ or
          $deb_version > 3.1 ) )
   {
     push(@ld_library_paths, $debug_libraries_path);