diff options
Diffstat (limited to 'socket.c')
-rw-r--r-- | socket.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -1,6 +1,6 @@ /* * HardInfo - Displays System Information - * Copyright (C) 2003-2007 Leandro A. F. Pereira <leandro@linuxmag.com.br> + * Copyright (C) 2003-2007 Leandro A. F. Pereira <leandro@hardinfo.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -99,7 +99,11 @@ int sock_read(Socket * s, gchar * buffer, gint size) gint n; n = read(s->sock, buffer, size); - buffer[n] = '\0'; + if (n > 0) { + buffer[n] = '\0'; + } else { + return 0; + } return n; } |