Supports both of GNU and BSD version `stat` . fixed #399

Signed-off-by: Rack Lin <racklin@gmail.com>
Merge pull request #412 from racklin/bugfix/bsd_stat

Supports both of GNU and BSD version `stat`