[asterisk-bugs] [Asterisk 0017345]: ast_close_fds_above_n off-by-one's

Asterisk Bug Tracker noreply at bugs.digium.com
Mon May 17 13:44:54 CDT 2010


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=17345 
====================================================================== 
Reported By:                wdoekes
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   17345
Category:                   Core/General
Reproducibility:            always
Severity:                   trivial
Priority:                   normal
Status:                     acknowledged
Asterisk Version:           SVN 
JIRA:                       SWP-1471 
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): 1.6.2 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2010-05-17 01:18 CDT
Last Modified:              2010-05-17 13:44 CDT
====================================================================== 
Summary:                    ast_close_fds_above_n off-by-one's
Description: 
Hi,

I was checking out the changes in 1.6.2.8rc1 and saw the
ast_close_fds_above_n edit in r256483.

http://svn.asterisk.org/svn/asterisk/branches/1.6.2/main/app.c

The function is called "above_n". Shouldn't then:
if ((x = strtol(entry->d_name, &result, 10)) && x >= n) {
be:
if ((x = strtol(entry->d_name, &result, 10)) && x > n) {


And, related, the usage in res_agi seems wrong too:

# wgrep . ast_close_fds_above_n | sed -e '/:void/d;s/[[:blank:]]\+//'
./apps/app_voicemail.c:ast_close_fds_above_n(STDOUT_FILENO);
./apps/app_dahdiras.c:ast_close_fds_above_n(STDERR_FILENO);
./apps/app_festival.c:ast_close_fds_above_n(0);
./apps/app_externalivr.c:ast_close_fds_above_n(STDERR_FILENO);
./apps/app_ices.c:ast_close_fds_above_n(STDERR_FILENO);
./apps/app_nbscat.c:ast_close_fds_above_n(STDERR_FILENO);
./apps/app_mp3.c:ast_close_fds_above_n(STDERR_FILENO);
./main/asterisk.c:ast_close_fds_above_n(STDERR_FILENO);
./main/asterisk.c:ast_close_fds_above_n(0);
./res/res_musiconhold.c:ast_close_fds_above_n(STDERR_FILENO);
./res/res_agi.c:ast_close_fds_above_n(STDERR_FILENO + 1);

# grep -B1 ast_close_fds_above_n ./res/res_agi.c
		/* Close everything but stdin/out/error */
		ast_close_fds_above_n(STDERR_FILENO + 1);
That should probably be ast_close_fds_above_n(STDERR_FILENO) like the
others.


Regards,
Walter Doekes
OSSO B.V.
====================================================================== 

---------------------------------------------------------------------- 
 (0122018) svnbot (reporter) - 2010-05-17 13:44
 https://issues.asterisk.org/view.php?id=17345#c122018 
---------------------------------------------------------------------- 
Repository: asterisk
Revision: 263587

U   branches/1.6.2/main/app.c

------------------------------------------------------------------------
r263587 | tilghman | 2010-05-17 13:44:53 -0500 (Mon, 17 May 2010) | 4
lines

Don't close 'n', just close 'above_n'.
(closes issue https://issues.asterisk.org/view.php?id=17345)
 Reported by: wdoekes

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=263587 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-05-17 13:44 svnbot         Note Added: 0122018                          
======================================================================




More information about the asterisk-bugs mailing list