summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2005-07-31 21:18:45 +0000
committermarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2005-07-31 21:18:45 +0000
commitb2f523c3a778d041edb01452ede64b645eef7774 (patch)
treef1de9e004eb4d03487ac0c35fbdfb6ef054c1e7e
parent02baa6db8e92ae755f7b49a39dbdbe0a991e2601 (diff)
Fix cat /proc/zaptel/foo bug (bug #4103)
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@713 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rwxr-xr-xzaptel.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/zaptel.c b/zaptel.c
index 83883b0..714fc66 100755
--- a/zaptel.c
+++ b/zaptel.c
@@ -470,9 +470,6 @@ static int zaptel_proc_read(char *page, char **start, off_t off, int count, int
/* In Linux 2.6, this MUST NOT EXECEED 1024 bytes in one read! */
- if (off > 0)
- return 0;
-
span = (long)data;
if (!span)
@@ -552,15 +549,20 @@ static int zaptel_proc_read(char *page, char **start, off_t off, int count, int
if (chans[x]->nextslave && chans[x]->master->channo == x)
len += sprintf(page + len, "Master ");
}
+ }
+ if ((chans[x]->flags & ZT_FLAG_OPEN)) {
+ len += sprintf(page + len, "(In use) ");
+ }
+ len += sprintf(page + len, "\n");
}
- if ((chans[x]->flags & ZT_FLAG_OPEN)) {
- len += sprintf(page + len, "(In use) ");
- }
- len += sprintf(page + len, "\n");
-
+ if ( len <= off ) /* If everything printed so far is before beginning of request */
+ {
+ off -= len;
+ len = 0;
}
}
}
+ *start = page + off;
return len;
}
#endif