summaryrefslogtreecommitdiff
path: root/socket.c
diff options
context:
space:
mode:
authorSimon Quigley <tsimonq2@ubuntu.com>2017-06-19 14:38:48 -0500
committerSimon Quigley <tsimonq2@ubuntu.com>2017-06-19 14:38:48 -0500
commit4979bb6cbbbe39eb44c32530cd13f86bf44e5d77 (patch)
tree614372cf2510ad45311ecea088012683635d0b76 /socket.c
parentee6c3f9b4cf08a276c971dee66e1acdb32b3dff9 (diff)
Import Upstream version 0.5c
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;
}