Workaround for some libarchive problems

1. archive_write_data may return 0. The manual page says it will return bytes
   actually written or -1 on error, but it does not say what zero means. This
   will cause infinite loop in the program.
2. libarchive may use NULL as its error message. It is not expected because
   NULL is not a valid string. Therefore, I remove replace g_error_new_literal
   with g_error_new to make sure the function return when error occurs.