summaryrefslogtreecommitdiff
path: root/mysys/my_read.c
diff options
context:
space:
mode:
authorsasha@mysql.sashanet.com <>2001-09-22 21:47:57 -0600
committersasha@mysql.sashanet.com <>2001-09-22 21:47:57 -0600
commit1a0a77389f3448dc2557a1a1fecafbeb86cc7b32 (patch)
tree5842a4d7b8d3728781c758ff3c724c456c3be963 /mysys/my_read.c
parent915106582eb32ddaee18b3b9da5fa1f61bec79b4 (diff)
downloadmariadb-git-1a0a77389f3448dc2557a1a1fecafbeb86cc7b32.tar.gz
added mysqlmanager-pwgen
added set_exec_stdout and set_exec_stderr to mysqlmanager to be able to redirect stdout and stderr added support for MY_FULL_IO to my_read, so we can tell it to read a number of bytes in as many chunks as it takes instead of one try
Diffstat (limited to 'mysys/my_read.c')
-rw-r--r--mysys/my_read.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/mysys/my_read.c b/mysys/my_read.c
index b317630f4bd..9a6c7f4d9dc 100644
--- a/mysys/my_read.c
+++ b/mysys/my_read.c
@@ -28,10 +28,11 @@ uint my_read(File Filedes, byte *Buffer, uint Count, myf MyFlags)
/* Max number of bytes returnd */
/* Flags on what to do on error */
{
- uint readbytes;
+ 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;
for (;;)
{
@@ -54,12 +55,21 @@ uint my_read(File Filedes, byte *Buffer, uint Count, myf MyFlags)
my_error(EE_EOFERR, MYF(ME_BELL+ME_WAITTANG),
my_filename(Filedes),my_errno);
}
- if ((int) readbytes == -1 || (MyFlags & (MY_FNABP | MY_NABP)))
+ if ((int) readbytes == -1 ||
+ ((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;
+ }
}
if (MyFlags & (MY_NABP | MY_FNABP))
readbytes=0; /* Ok on read */
+ else if (MyFlags & MY_FULL_IO)
+ readbytes=save_count;
break;
}
DBUG_RETURN(readbytes);