diff options
-rw-r--r-- | socket-sucker.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/socket-sucker.c b/socket-sucker.c index d711cb0..54aee32 100644 --- a/socket-sucker.c +++ b/socket-sucker.c @@ -62,11 +62,14 @@ main (int argc, char * argv[]) int out = 0; in = read(socket_fd, buffer, BUFFER_SIZE); - out = write(1, buffer, in); + + if (in > 0) { + out = write(1, buffer, in); + } close(socket_fd); - if (in == 0) { + if (in > 0 && out > 0) { return 0; } else { return -1; |