libsysactivity (0.5.4-6) mem-swap-issue.patch

Summary

 src/Linux/memory.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

    
download this patch

Patch contents

Description: Fixes an issue with reading the swap partitions.
Origin: upstream, http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=593018#20
Bug-Debian: http://bugs.debian.org/593018

--- a/src/Linux/memory.c	2010-08-16 16:28:21.623394753 +0200
+++ b/src/Linux/memory.c	2010-08-16 16:18:16.863387894 +0200
@@ -157,12 +157,12 @@
 
 	*written = 0;
 	int i;
-	for (i = 0; i < dst_size; i++) {
-		if (fgets(line_buffer, sizeof line_buffer, file_swaps) == NULL)
-			return EIO;
+	for (i = 0; fgets(line_buffer, sizeof line_buffer, file_swaps) != NULL; i++) {
+		if (i >= dst_size)
+			return ENOMEM;
 
 		errno = 0;
-		parse_swap(dst, line_buffer);
+		parse_swap(&dst[i], line_buffer);
 		if (errno != 0)
 			return ENOSYS;