[svn-commits] sruffell: linux/trunk r6675 - /linux/trunk/drivers/dahdi/dahdi-base.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Thu Jun 4 16:14:57 CDT 2009
Author: sruffell
Date: Thu Jun 4 16:14:53 2009
New Revision: 6675
URL: http://svn.asterisk.org/svn-view/dahdi?view=rev&rev=6675
Log:
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)
Modified:
linux/trunk/drivers/dahdi/dahdi-base.c
Modified: linux/trunk/drivers/dahdi/dahdi-base.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/trunk/drivers/dahdi/dahdi-base.c?view=diff&rev=6675&r1=6674&r2=6675
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi-base.c (original)
+++ linux/trunk/drivers/dahdi/dahdi-base.c Thu Jun 4 16:14:53 2009
@@ -552,12 +552,16 @@
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<count<=PROC_BLOCK_SIZE . count=1 will produce an error in
+ * vsnprintf ('head -c 1 /proc/dahdi/1', 'dd bs=1').
+ * An ugly hack. Good way: seq_printf (seq_file.c). */
+ real_count = count;
+ count = PAGE_SIZE-1024;
span = (long)data;
-
if (!span)
return 0;
@@ -678,10 +682,14 @@
/* stop if we've already generated enough */
if (len > 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;
More information about the svn-commits
mailing list