avoid operations on closed file handles in embedded languages

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12255 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2009-02-23 19:52:29 +00:00
parent 1daa0746e3
commit ea88aed04b
3 changed files with 20 additions and 0 deletions
+12
View File
@@ -332,6 +332,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_seek(switch_file_handle_t *fh,
switch_assert(fh != NULL);
switch_assert(fh->file_interface != NULL);
if (!switch_test_flag(fh, SWITCH_FILE_OPEN)) {
return SWITCH_STATUS_FALSE;
}
if (!fh->file_interface->file_seek) {
return SWITCH_STATUS_FALSE;
}
@@ -349,6 +353,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_set_string(switch_file_handle_t
switch_assert(fh != NULL);
switch_assert(fh->file_interface != NULL);
if (!switch_test_flag(fh, SWITCH_FILE_OPEN)) {
return SWITCH_STATUS_FALSE;
}
if (!fh->file_interface->file_set_string) {
return SWITCH_STATUS_FALSE;
}
@@ -361,6 +369,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_get_string(switch_file_handle_t
switch_assert(fh != NULL);
switch_assert(fh->file_interface != NULL);
if (!switch_test_flag(fh, SWITCH_FILE_OPEN)) {
return SWITCH_STATUS_FALSE;
}
if (!fh->file_interface->file_get_string) {
return SWITCH_STATUS_FALSE;
}