From 4896fd81a50814843680bd03fcba46643f08c95e Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 27 Sep 2016 14:55:06 -0700 Subject: 3427 --- 091socket.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/091socket.cc b/091socket.cc index a06f4b1b..4725d282 100644 --- a/091socket.cc +++ b/091socket.cc @@ -145,7 +145,7 @@ case _READ_FROM_SOCKET: { char contents[bytes]; bzero(contents, bytes); int bytes_read = read(socket_fd, contents, bytes - 1 /* null-terminated */); - //?: cerr << "Read:\n" << string(contents) << "\n"; +//? cerr << "Read:\n" << string(contents) << "\n"; products.resize(2); products.at(0).push_back(new_mu_text(string(contents))); products.at(1).push_back(bytes_read); @@ -171,7 +171,10 @@ case _WRITE_TO_SOCKET: { // Write one character to a session at a time. long long int y = static_cast(ingredients.at(1).at(0)); char c = static_cast(y); - write(session->fd, &c, 1); + if (write(session->fd, &c, 1) != 1) { + raise << maybe(current_recipe_name()) << "failed to write to socket\n" << end(); + exit(0); + } long long int result = reinterpret_cast(session); products.resize(1); products.at(0).push_back(result); -- cgit 1.4.1-2-gfad0