View topic - remove () failed

Page 1 of 1

remove () failed

PostPosted: Tue Sep 13, 2011 1:08 pm
by rashidmirza
i have a piece of code, where certain directories and files are deleted, once they are deemed to be aged (certain criteria applicable).
This works fine, until the software encounters files that have funny characters in them, and this is caused if there is corruption on the system. Ideally there should not be any corruption.
Is there any way to make the software more intelligent, when it comes to deleting files that have funny names?

deletion of file is being done using the remove() function.
I think the program encounters a problem when it tries to :

pDir = readdir(pDirH)

AFTER a failed remove(),
on the contrary, if the remove is successful, then readdir is fine..
I want to keep program flow working, rather than trying to delete corrupt files..any ideas..any checks i can introduce, after the remove, or before the readdir?

Re: remove () failed

PostPosted: Fri Sep 16, 2011 8:41 am
by rashidmirza
just want to add also , that the directory object i.e dirObj = readdir(someDirectory) is null after a failed remove().

Re: remove () failed

PostPosted: Sat Sep 17, 2011 8:00 am
by maschoen
How about this. If your file system is corrupted, all bets are off. At startup run chkfsys. While you are up and running, you should not get any corruption in the file system unless you are having hardware problems with memory or the hard drive. If you are having hardware problems, all bets are off.