fat_delete does not delete files with zero length

fat_delete fails with errno EFAULT (-14) if the file has a size of 0 bytes.

The file is copied to the Rabbit via FTP.

The result is, that the file cannot be deleted at all.

What is wrong?

What version of Dynamic C?

Is the Rabbit acting as FTP client or server?

Is the file copied to the Rabbit actually 0 bytes, or is it a failed transfer of some sort?

If you exit your program and re-launch it, are you able to delete the file?

Can you provide a “steps to reproduce” using one of the existing Sample programs so I can investigate the problem and look for a root cause?

Hello Tom, thank you for the answer.

  • The version is 10.64.
  • The Rabbit is the ftp-server.
  • at the moment i do not have the Rabbit system available. I analyzed log files of the Rabbit and found that the problem seems to be related to the file size of 0 bytes.
    The Rabbit SW cyclically checks if this file exists and should do something according to the file content and afterwards deletes the file. but this delete fails with EFAULT.
    Also it is not possible to delete the file via ftp. Although the file is seen, the response to the ftp delete is “file not found”.

A re-start of the Rabbit does not help. The file is not deleted.
Because i don’t have a Rabbit available at the moment (in two weeks i will get one) i cannot give a step by step procedure.

if i do not find the root cause, i will try to re-partion “PartitionA” where the file is stored.

any more help is appreciated very much. i will hopefully know more in two weeks.

I couldn’t find anything in the release notes of the current version (10.72E) that might apply to this situation (either a FAT or FTP Server issue). It might be possible that there’s file system corruption of some sort causing the errors. Or existing code is holding an open handle to the file and that’s causing the delete to fail.

If possible, I would recommend upgrading to Dynamic C 10.72E and updating the firmware. It’s possible there’s a bug fix that wasn’t called out in the release notes. If you can reproduce the failure using standard development hardware, I can investigate and provide a patch to resolve the issue.