Spiffs: SPIFFS_rename behaviour

Created on 9 Jan 2017  路  2Comments  路  Source: pellepl/spiffs

I don't expect this to be addressed immediately, but perhaps in some future revision...

rename() is commonly used to safely write files, i.e. prepare a temp file and then move it into place. it's a good practice, but its safety hinges on the atomicity of rename and its behavior wrt destinations that already exist. it would be nice if SPIFFS_rename behaved closer to POSIX, specifically: it should be atomic and should not fail if newPath exists, it should silently delete newPath in this case.

see here for detailed spec.

enhancement

Most helpful comment

Ah, I did not know that this was the posix way. Will fix in som indefinable
future 馃槈. Thanks for the heads up!

Cheers / P

All 2 comments

Ah, I did not know that this was the posix way. Will fix in som indefinable
future 馃槈. Thanks for the heads up!

Cheers / P

perhaps the latter (delete if src != dst and dst already exists) is simpler to implement.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pellepl picture pellepl  路  33Comments

MostafaASG picture MostafaASG  路  9Comments

nathanejohnson picture nathanejohnson  路  3Comments

geoffeg picture geoffeg  路  3Comments

ziram picture ziram  路  3Comments