patch-2.1.86 linux/drivers/char/vc_screen.c

Next file: linux/drivers/isdn/avmb1/b1capi.c
Previous file: linux/drivers/char/sysrq.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.85/linux/drivers/char/vc_screen.c linux/drivers/char/vc_screen.c
@@ -16,8 +16,7 @@
  * aeb@cwi.nl - efter Friedas begravelse - 950211
  *
  * machek@k332.feld.cvut.cz - modified not to send characters to wrong console
- *	 - fixed some fatal of-by-one bugs (0-- no longer == -1 -> looping and looping and looping...)
- *	 - making it working with multiple monitor patches
+ *	 - fixed some fatal off-by-one bugs (0-- no longer == -1 -> looping and looping and looping...)
  *	 - making it shorter - scr_readw are macros which expand in PRETTY long code
  */
 
@@ -76,24 +75,22 @@
 
 static long long vcs_lseek(struct file *file, long long offset, int orig)
 {
-	int size;
-	size = vcs_size(file->f_dentry->d_inode);
+	int size = vcs_size(file->f_dentry->d_inode);
 
 	switch (orig) {
-		case 0:
-			file->f_pos = offset;
+		default:
+			return -EINVAL;
+		case 2:
+			offset += size;
 			break;
 		case 1:
-			file->f_pos += offset;
-			break;
-		case 2:
-			file->f_pos = size + offset;
+			offset += file->f_pos;
+		case 0:
 			break;
-		default:
-			return -EINVAL;
 	}
-	if (file->f_pos < 0 || file->f_pos > size)
-		{ file->f_pos = 0; return -EINVAL; }
+	if (offset < 0 || offset > size)
+		return -EINVAL;
+	file->f_pos = offset;
 	return file->f_pos;
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov