#161417 - Dwedit - Sun Aug 03, 2008 3:34 am
When I call "dirnext" using the FCSR dldi driver, memory on the stack gets corrupted, and a block of data gets written to address 0.
More specifically:
If I allocate a big dummy array on the stack before calling dirnext, I get no bad effects. If I don't, I get a corrupted stack.
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."
Last edited by Dwedit on Sun Aug 03, 2008 8:54 pm; edited 1 time in total
More specifically:
Code: |
int find_next_file(char filename[]) { if (dir_global==NULL) { return find_first_file(filename); } struct stat st; int type; int err=dirnext(dir_global,filename,&st); if (err==-1) { free_dir_iterator(); return 0; } else { type = (st.st_mode & S_IFDIR) ? 2 : 1; } return type; } |
If I allocate a big dummy array on the stack before calling dirnext, I get no bad effects. If I don't, I get a corrupted stack.
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."
Last edited by Dwedit on Sun Aug 03, 2008 8:54 pm; edited 1 time in total