owncloud/apps — pull request #1820 by PVince81 (2014-06-23 14:03:10+00:00)
Title: Fix infinite loop when fopen failed when obtaining lock

If for some reason fopen() fails in obtainReadLock() or
obtainWriteLock(), the function now returns with false instead of
needlessly trying to acquire a lock.

The original issue had the "false" $handle caused an infinite loop in
the do-while block.

Steps to reproduce:
1. Upload about 200 pictures in a folder
2. Navigate into the folder
3. Quickly, before the previews are created, click select all and delete
4. Go to trashbin
5. Quickly, before the previews are created, click select all and delete

I believe that the issue should happen at step 3 already.
You should see at least one warning entry in the log with "No such file or directory".

Before this fix, an infinite loop was produced.
After this fix, it should fail gracefully.

Fixes #1817

Please review @DeepDiver1975 @icewind1991 @schiesbn