Hello, I've just discovered that 'open' returns a new descriptor (new_fd) when you open a file several times and that fcntl( new_fd, F_SETLK ... and fcntl( new_fd, F_GETLK ... won't see if the file was already locked : You can get several exclusive locks by opening a file several times and using fcntl( new_fd, F_SETLK ( it looks strange to me ???). So how do you check if a file has already been opened by the same process (without maintaining a list of opened files) ? Just another little question : do the following code work everywhere : char *p; p = malloc( 10); p += 4; free( p); david
