patch-2.4.27 linux-2.4.27/drivers/char/i8k.c

Next file: linux-2.4.27/drivers/char/istallion.c
Previous file: linux-2.4.27/drivers/char/drm/sis_mm.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.26/drivers/char/i8k.c linux-2.4.27/drivers/char/i8k.c
@@ -493,6 +493,7 @@
 
 static ssize_t i8k_read(struct file *f, char *buffer, size_t len, loff_t *fpos)
 {
+    loff_t pos = *fpos;
     int n;
     char info[128];
 
@@ -501,19 +502,19 @@
 	return n;
     }
 
-    if (*fpos >= n) {
+    if (pos != (unsigned)pos || pos >= n) {
 	return 0;
     }
 
-    if ((*fpos + len) >= n) {
-	len = n - *fpos;
+    if (len >= n - pos) {
+	len = n - pos;
     }
 
     if (copy_to_user(buffer, info, len) != 0) {
 	return -EFAULT;
     }
 
-    *fpos += len;
+    *fpos = pos + len;
     return len;
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)