Include <sys/stat.h> instead of <stat.h>. Tracks change in an uncontrolled branch