[zaptel-commits] russell: trunk r1316 - in /trunk: ./ fxotune.c
zaptel-commits at lists.digium.com
zaptel-commits at lists.digium.com
Tue Aug 15 15:14:21 MST 2006
Author: russell
Date: Tue Aug 15 17:14:21 2006
New Revision: 1316
URL: http://svn.digium.com/view/zaptel?rev=1316&view=rev
Log:
Merged revisions 1315 via svnmerge from
https://origsvn.digium.com/svn/zaptel/branches/1.2
........
r1315 | russell | 2006-08-15 18:06:13 -0400 (Tue, 15 Aug 2006) | 4 lines
Ensure that fopen() is only called once for the debug output file to prevent
excessive file descriptor leakage when this function is called many times in
a loop. (issue #7203)
........
Modified:
trunk/ (props changed)
trunk/fxotune.c
Propchange: trunk/
------------------------------------------------------------------------------
--- branch-1.2-merged (original)
+++ branch-1.2-merged Tue Aug 15 17:14:21 2006
@@ -1,1 +1,1 @@
-/branches/1.2:1-916,918-936,938-949,958,962,970,990,1004,1011,1017,1031,1033,1060,1062,1064-1066,1069,1071,1076,1079,1081,1097,1101,1151,1185,1187,1205,1233,1235-1236,1243,1248,1259,1262,1298,1300,1304,1306,1311,1313
+/branches/1.2:1-916,918-936,938-949,958,962,970,990,1004,1011,1017,1031,1033,1060,1062,1064-1066,1069,1071,1076,1079,1081,1097,1101,1151,1185,1187,1205,1233,1235-1236,1243,1248,1259,1262,1298,1300,1304,1306,1311,1313,1315
Modified: trunk/fxotune.c
URL: http://svn.digium.com/view/zaptel/trunk/fxotune.c?rev=1316&r1=1315&r2=1316&view=diff
==============================================================================
--- trunk/fxotune.c (original)
+++ trunk/fxotune.c Tue Aug 15 17:14:21 2006
@@ -86,6 +86,8 @@
static short outbuf[TEST_DURATION];
static int debug = 0;
+static FILE *debugoutfile = NULL;
+
/**
* Makes sure that the line is clear.
* Right now, we do this by relying on the user to specify how long after dialing the
@@ -261,7 +263,6 @@
struct zt_bufferinfo bi;
short inbuf[TEST_DURATION]; /* changed from BUFFER_LENGTH - this buffer is for short values, so it should be allocated using the length of the test */
FILE *outfile = NULL;
-
outfile = fopen("fxotune_dump.vals", "w");
if (!outfile) {
@@ -392,12 +393,9 @@
struct zt_bufferinfo bi;
short inbuf[TEST_DURATION];
- FILE *outfile = NULL;
-
-
- if (debug) {
- outfile = fopen("fxotune.vals", "w");
- if (!outfile) {
+
+ if (debug && !debugoutfile) {
+ if (!(debugoutfile = fopen("fxotune.vals", "w"))) {
fprintf(stdout, "Cannot create fxotune.vals\n");
return -1;
}
@@ -516,7 +514,7 @@
echo
);
- fprintf(outfile, "%s\n", result);
+ fprintf(debugoutfile, "%s\n", result);
if (debug > 1)
fprintf(stdout, "%s\n", result);
}
More information about the zaptel-commits
mailing list