Check for lock file in non-writable directories

On some linux systems /var/lock is not writable by users which are not
root and not in the uucp or dialout group.
If the root user acquires a lock and you are trying to access the same
port with a non-root user it will not check for the lock but creates a
new lock file in /tmp instead.
This change checks in readable directories for lock files.

Change-Id: Ia308fd344d2fe9d3c699f7a428ff620ea101eff3
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>