Check return values of fwrite()
Don't use deprecated libarchive functions, if possible