[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:34:33 CDT 2010


The following issue has been UPDATED. 
====================================================================== 
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:                        
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:34 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.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-05-17 13:34 lmadsen        Description Updated                          
======================================================================




More information about the asterisk-bugs mailing list