summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysys/my_read.c47
-rw-r--r--scripts/mysqlhotcopy.sh7
2 files changed, 29 insertions, 25 deletions
diff --git a/mysys/my_read.c b/mysys/my_read.c
index b7621ac99eb..bca28694295 100644
--- a/mysys/my_read.c
+++ b/mysys/my_read.c
@@ -36,48 +36,51 @@
uint my_read(File Filedes, byte *Buffer, uint Count, myf MyFlags)
{
- uint readbytes,save_count;
+ uint readbytes, save_count;
DBUG_ENTER("my_read");
DBUG_PRINT("my",("Fd: %d Buffer: %lx Count: %u MyFlags: %d",
- Filedes, Buffer, Count, MyFlags));
- save_count=Count;
+ Filedes, Buffer, Count, MyFlags));
+ save_count= Count;
for (;;)
{
- errno=0; /* Linux doesn't reset this */
- if ((readbytes = (uint) read(Filedes, Buffer, Count)) != Count)
+ errno= 0; /* Linux doesn't reset this */
+ if ((readbytes= (uint) read(Filedes, Buffer, Count)) != Count)
{
- my_errno=errno ? errno : -1;
+ my_errno= errno ? errno : -1;
DBUG_PRINT("warning",("Read only %ld bytes off %ld from %d, errno: %d",
- readbytes,Count,Filedes,my_errno));
+ readbytes, Count, Filedes, my_errno));
#ifdef THREAD
- if (readbytes == 0 && errno == EINTR)
- continue; /* Interrupted */
+ if ((int) readbytes <= 0 && errno == EINTR)
+ {
+ DBUG_PRINT("debug", ("my_read() was interrupted and returned %d", (int) readbytes));
+ continue; /* Interrupted */
+ }
#endif
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
{
- if ((int) readbytes == -1)
- my_error(EE_READ, MYF(ME_BELL+ME_WAITTANG),
- my_filename(Filedes),my_errno);
- else if (MyFlags & (MY_NABP | MY_FNABP))
- my_error(EE_EOFERR, MYF(ME_BELL+ME_WAITTANG),
- my_filename(Filedes),my_errno);
+ if ((int) readbytes == -1)
+ my_error(EE_READ, MYF(ME_BELL+ME_WAITTANG),
+ my_filename(Filedes),my_errno);
+ else if (MyFlags & (MY_NABP | MY_FNABP))
+ my_error(EE_EOFERR, MYF(ME_BELL+ME_WAITTANG),
+ my_filename(Filedes),my_errno);
}
if ((int) readbytes == -1 ||
- ((MyFlags & (MY_FNABP | MY_NABP)) && !(MyFlags & MY_FULL_IO)))
- DBUG_RETURN(MY_FILE_ERROR); /* Return with error */
+ ((MyFlags & (MY_FNABP | MY_NABP)) && !(MyFlags & MY_FULL_IO)))
+ DBUG_RETURN(MY_FILE_ERROR); /* Return with error */
if (readbytes > 0 && (MyFlags & MY_FULL_IO))
{
- Buffer+=readbytes;
- Count-=readbytes;
- continue;
+ Buffer+= readbytes;
+ Count-= readbytes;
+ continue;
}
}
if (MyFlags & (MY_NABP | MY_FNABP))
- readbytes=0; /* Ok on read */
+ readbytes= 0; /* Ok on read */
else if (MyFlags & MY_FULL_IO)
- readbytes=save_count;
+ readbytes= save_count;
break;
}
DBUG_RETURN(readbytes);
diff --git a/scripts/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh
index f9e29e33195..b3ea9dc4035 100644
--- a/scripts/mysqlhotcopy.sh
+++ b/scripts/mysqlhotcopy.sh
@@ -262,6 +262,7 @@ my $hc_locks = "";
my $hc_tables = "";
my $num_tables = 0;
my $num_files = 0;
+my $raid_dir_regex = '[A-Za-z0-9]{2}';
foreach my $rdb ( @db_desc ) {
my $db = $rdb->{src};
@@ -296,7 +297,7 @@ foreach my $rdb ( @db_desc ) {
my @raid_dir = ();
while ( defined( my $name = readdir DBDIR ) ) {
- if ( $name =~ /^\d\d$/ && -d "$db_dir/$name" ) {
+ if ( $name =~ /^$raid_dir_regex$/ && -d "$db_dir/$name" ) {
push @raid_dir, $name;
}
else {
@@ -604,7 +605,7 @@ sub copy_files {
# add recursive option for scp
$cp.= " -r" if $^O =~ /m^(solaris|linux|freebsd|darwin)$/ && $method =~ /^scp\b/;
- my @non_raid = map { "'$_'" } grep { ! m:/\d{2}/[^/]+$: } @$files;
+ my @non_raid = map { "'$_'" } grep { ! m:/$raid_dir_regex/[^/]+$: } @$files;
# add files to copy and the destination directory
safe_system( $cp, @non_raid, "'$target'" ) if (@non_raid);
@@ -797,7 +798,7 @@ sub get_raid_dirs {
my %dirs = ();
foreach my $f ( @$r_files ) {
- if ( $f =~ m:^(\d\d)/: ) {
+ if ( $f =~ m:^($raid_dir_regex)/: ) {
$dirs{$1} = 1;
}
}