Changeset: 3da538ee54ff for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3da538ee54ff
Modified Files:
clients/mapiclient/stethoscope.c
clients/mapiclient/tachograph.c
clients/mapiclient/tomograph.c
Branch: Jun2016
Log Message:
Two consecutive 0 length reads from a stream means the end.
Now applied to all three applications.
diffs (39 lines):
diff --git a/clients/mapiclient/stethoscope.c b/clients/mapiclient/stethoscope.c
--- a/clients/mapiclient/stethoscope.c
+++ b/clients/mapiclient/stethoscope.c
@@ -339,6 +339,9 @@ main(int argc, char **argv)
}
conn = mapi_get_from(dbh);
while ((n = mnstr_read(conn, buffer + len, 1, buflen - len-1)) >= 0) {
+ if (n == 0 &&
+ (n = mnstr_read(conn, buffer + len, 1, buflen - len-1)) <=
0)
+ break;
buffer[len + n] = 0;
response = buffer;
if( debug)
diff --git a/clients/mapiclient/tachograph.c b/clients/mapiclient/tachograph.c
--- a/clients/mapiclient/tachograph.c
+++ b/clients/mapiclient/tachograph.c
@@ -521,6 +521,9 @@ main(int argc, char **argv)
}
conn = mapi_get_from(dbh);
while ((n = mnstr_read(conn, buffer + len, 1, buflen - len-1)) >= 0) {
+ if (n == 0 &&
+ (n = mnstr_read(conn, buffer + len, 1, buflen - len-1)) <=
0)
+ break;
buffer[len + n] = 0;
response = buffer;
while ((e = strchr(response, '\n')) != NULL) {
diff --git a/clients/mapiclient/tomograph.c b/clients/mapiclient/tomograph.c
--- a/clients/mapiclient/tomograph.c
+++ b/clients/mapiclient/tomograph.c
@@ -1877,7 +1877,8 @@ main(int argc, char **argv)
resetTomograph();
conn = mapi_get_from(dbh);
while ((m = mnstr_read(conn, buffer + len, 1, buflen - len-1))
>= 0) {
- if (m == 0 && (m = mnstr_read(conn, buffer + len, 1,
buflen - len-1)) <= 0)
+ if (m == 0 &&
+ (m = mnstr_read(conn, buffer + len, 1, buflen -
len-1)) <= 0)
break;
buffer[len + m] = 0;
response = buffer;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list