patch-2.3.99-pre7 linux/drivers/char/misc.c
Next file: linux/drivers/char/moxa.c
Previous file: linux/drivers/char/istallion.c
Back to the patch index
Back to the overall index
- Lines: 29
- Date:
Fri May 5 12:23:20 2000
- Orig file:
v2.3.99-pre6/linux/drivers/char/misc.c
- Orig date:
Wed Apr 26 16:34:07 2000
diff -u --recursive --new-file v2.3.99-pre6/linux/drivers/char/misc.c linux/drivers/char/misc.c
@@ -85,12 +85,24 @@
int len, int *eof, void *private)
{
struct miscdevice *p;
+ int written;
- len=0;
- for (p = misc_list.next; p != &misc_list && len < 4000; p = p->next)
- len += sprintf(buf+len, "%3i %s\n",p->minor, p->name ?: "");
+ written=0;
+ for (p = misc_list.next; p != &misc_list && written < len; p = p->next) {
+ written += sprintf(buf+written, "%3i %s\n",p->minor, p->name ?: "");
+ if (written < offset) {
+ offset -= written;
+ written = 0;
+ }
+ }
*start = buf + offset;
- return len > offset ? len - offset : 0;
+ written -= offset;
+ if(written > len) {
+ *eof = 0;
+ return len;
+ }
+ *eof = 1;
+ return (written<0) ? 0 : written;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)