Use mode_t in struct to grab file permissions.

Also fix up some minor layout issues and compile warning.