Add support of taking from work_dir or curdir (not only from wal_dir and snap_dir)
Fix order of searchin wals/snaps
Move to safely analogs of functions
move linux/limits.h to limits.h
Merge branch 'gh-102-dir' into stable
Merge remote-tracking branch 'origin/stable'