summaryrefslogtreecommitdiff
path: root/socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'socket.c')
-rw-r--r--socket.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/socket.c b/socket.c
index daf6f434..cada32b6 100644
--- a/socket.c
+++ b/socket.c
@@ -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;
}