Summary:ASTERISK-04521: file.c: ast_readfile deletes files
Reporter:clan (clan)Labels:
Date Opened:2005-07-05 07:19:34Date Closed:2008-01-15 15:39:48.000-0600
Versions:Frequency of
Description:In ast_readfile, when the ast_filestream can not be created the input file is removed. This happened here when trying to open a '.wav'-file with unsupported sampling parameters. This seems to be wrong, a file opened for reading should never be deleted.

The same applies to ast_writefile, the file should only be deleted when it is openend with O_TRUNC.

Comments:By: Kevin P. Fleming (kpfleming) 2005-07-05 10:38:33

This has been fixed in CVS HEAD... I agree, there is no reason to attempt to unlink a file just because a format module couldn't open it.

By: Digium Subversion (svnbot) 2008-01-15 15:39:48.000-0600

Repository: asterisk
Revision: 6020

U   trunk/file.c

r6020 | kpfleming | 2008-01-15 15:39:47 -0600 (Tue, 15 Jan 2008) | 3 lines

don't unlink files just because they can't be opened (bug ASTERISK-4521)
clean up and reformat ast_readfile and ast_writefile