diff options
author | unknown <gkodinov/kgeorge@magare.gmz> | 2007-07-11 12:44:49 +0300 |
---|---|---|
committer | unknown <gkodinov/kgeorge@magare.gmz> | 2007-07-11 12:44:49 +0300 |
commit | ecbd9efeb07e459f7b82421171f62c2365082cb5 (patch) | |
tree | 33a89b17daf3bef24b5515c994afae18ad2e1d16 /mysys/my_conio.c | |
parent | 2ca32b764b97f1409dda5f648086075cab2559db (diff) | |
parent | 3881f2a24dd531077d99b9a646c437d98e05c994 (diff) | |
download | mariadb-git-ecbd9efeb07e459f7b82421171f62c2365082cb5.tar.gz |
Merge magare.gmz:/home/kgeorge/mysql/autopush/B29325-5.0-opt
into magare.gmz:/home/kgeorge/mysql/work/B29325-merge-5.1-opt
client/mysql.cc:
Auto merged
include/my_base.h:
Auto merged
mysql-test/r/ctype_collate.result:
Auto merged
mysql-test/r/gis-rtree.result:
Auto merged
mysql-test/t/gis-rtree.test:
Auto merged
storage/myisam/mi_create.c:
Auto merged
strings/ctype-simple.c:
Auto merged
mysys/my_conio.c:
5.0-opt -> 5.1.-opt merge
storage/myisam/sp_key.c:
5.0-opt -> 5.1.-opt merge
Diffstat (limited to 'mysys/my_conio.c')
-rw-r--r-- | mysys/my_conio.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/mysys/my_conio.c b/mysys/my_conio.c index 1ea1f7a820a..b78966446ee 100644 --- a/mysys/my_conio.c +++ b/mysys/my_conio.c @@ -187,15 +187,19 @@ char* my_cgets(char *buffer, size_t clen, size_t* plen) while (GetLastError() == ERROR_NOT_ENOUGH_MEMORY); *plen= plen_res; + /* We go here on error reading the string (Ctrl-C for example) */ + if (!*plen) + result= NULL; /* purecov: inspected */ + if (result != NULL) { - if (buffer[*plen - 2] == '\r') + if (*plen > 1 && buffer[*plen - 2] == '\r') { *plen= *plen - 2; } else { - if (buffer[*plen - 1] == '\r') + if (*plen > 0 && buffer[*plen - 1] == '\r') { char tmp[3]; int tmplen= sizeof(tmp); |