Moved inclusion of <sys/errno.h> to the beginning and declared errno