tot_size cannot ever be equal to 0 because of it initialization:
tot_size = sizeof(struct log_global_header);