summaryrefslogtreecommitdiff
path: root/sysdeps/linux/glibtop_server.h
diff options
context:
space:
mode:
authorMartin Baulig <martin@src.gnome.org>2000-02-14 14:25:34 +0000
committerMartin Baulig <martin@src.gnome.org>2000-02-14 14:25:34 +0000
commit00a32c887cfc3f0ad85e6a3ec4ca91ac5c9431a0 (patch)
tree607d4afbb5720306067be0f2579a125025f2b951 /sysdeps/linux/glibtop_server.h
parentc92bf0f9a9106d8e6ca33f2edbbf5e56ea2b5bb4 (diff)
downloadlibgtop-00a32c887cfc3f0ad85e6a3ec4ca91ac5c9431a0.tar.gz
Make sure we close all open files.
Diffstat (limited to 'sysdeps/linux/glibtop_server.h')
-rw-r--r--sysdeps/linux/glibtop_server.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/sysdeps/linux/glibtop_server.h b/sysdeps/linux/glibtop_server.h
index 4889d2df..a8d3e083 100644
--- a/sysdeps/linux/glibtop_server.h
+++ b/sysdeps/linux/glibtop_server.h
@@ -71,10 +71,11 @@ proc_file_to_buffer (char *buffer, const char *fmt, pid_t pid)
if (fd < 0) return -1;
len = read (fd, buffer, BUFSIZ-1);
- if (len < 0) return -1;
-
close (fd);
+ if (len < 0)
+ return -1;
+
buffer [len] = '\0';
return 0;