replace open() with lstat()

Check for symlinks with lstat() not open()
Change-Id: Ie0d8d94b426c84c29b1b04d41a4cc15536cb307c