From 0a26bdc4985c50dd6fe28bd7ece6f2e2320dfc55 Mon Sep 17 00:00:00 2001 From: dcp1990 Date: Tue, 28 Jun 2005 02:01:28 +0000 Subject: [PATCH] Gracefully exit --- phonectl/phonectl.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/phonectl/phonectl.c b/phonectl/phonectl.c index 73b3fc1..8c7cfa3 100644 --- a/phonectl/phonectl.c +++ b/phonectl/phonectl.c @@ -27,7 +27,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -/* $Amigan: phoned/phonectl/phonectl.c,v 1.7 2005/06/26 02:56:36 dcp1990 Exp $ */ +/* $Amigan: phoned/phonectl/phonectl.c,v 1.8 2005/06/28 02:01:28 dcp1990 Exp $ */ /* system includes */ #include #include @@ -92,7 +92,10 @@ int main(argc, argv) send(s, buff, strlen(buff) + 1, 0x0); } if(FD_ISSET(s, &fds)) { - recv(s, buff, sizeof(buff), 0x0); + if(recv(s, buff, sizeof(buff), 0x0) == 0) { + close(s); + return 0; + } fputs(buff, stdout); } }