I'll explain. I'm writing an application which read files and add them to another file. I've tried it on my "Desktop" directory and it works fine. But once I try it on my "/home/user1/" directory(where user1 is your login name) for some files it works and some it don't. Especially that file: "/home/user1/.synfig/fifo". I've tried also with that minimal code and believe me or not even in debug if you press F8 on the ReadFile() line it never get to the "IF". I've read a bit about locks mechanism on linux and I've known that there is 3 different locks types. See http://www.unixguide.net/unix/programming/2.5.shtml and if an application don't use the same lock types as the other one it can delete/read the file even if locked by another application. I don't know what is the type of lock used by the applicaton wich open that file. But, it think it would be better to make sure ReadFile() don't block at all and just return 0 whatever the lock type used. BTW here is the code.:
Code: Select all
Global GintIDFile.l = ReadFile(#PB_Any, "/home/user1/.synfig/fifo")
;It never reach the IF when the file is locked.
If GintIDFile = 0
Debug "Failed"
Else
Debug "Succeeded"
EndIf


