From 11e24b3828139533818137c1a8dbb1ce8d489c27 Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Thu, 4 Jun 2009 21:14:53 +0000 Subject: dahdi-base: Fix bug in procfs handling. Fix bug in procfs handling where it was possible to get a warning in lib/vsprintf.c when reading from /proc/dahdi/x. Patch by: biohumanoid (closes issue #15252) git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@6675 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/dahdi-base.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c index 4741720..632d0d2 100644 --- a/drivers/dahdi/dahdi-base.c +++ b/drivers/dahdi/dahdi-base.c @@ -552,12 +552,16 @@ static int fill_alarm_string(char *buf, int count, int alarms) static int dahdi_proc_read(char *page, char **start, off_t off, int count, int *eof, void *data) { - int x, len = 0; + int x, len = 0, real_count; long span; - /* In Linux 2.6, this MUST NOT EXECEED 1024 bytes in one read! */ + /* In Linux 2.6, page is always PROC_BLOCK_SIZE=(PAGE_SIZE-1024) bytes. + * 0 off + count) break; + /* stop if we're NEAR danger limit. let it be -128 bytes. */ + if (len > count-128) + break; } + count = real_count; /* If everything printed so far is before beginning of request */ if (len <= off) { - off -= len; + off = 0; len = 0; } *start = page + off; -- cgit v1.2.3