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
-  Lines: 32
 -  Date:
2004-08-07 16:26:04.701348709 -0700
 -  Orig file: 
linux-2.4.26/drivers/char/i8k.c
 -  Orig date: 
2002-11-28 15:53:12.000000000 -0800
 
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)