unpack: check rv and also errno, not rv twice!

--HG--
extra : convert_revision : f30a7c3135c05f55e6b6d6acd50f17d79e623c85
This commit is contained in:
Juan RP 2009-02-18 03:15:37 +01:00
parent 2f287003e0
commit 8fa094ff02

View file

@ -204,7 +204,7 @@ unpack_archive_fini(struct archive *ar, const char *destdir, int flags,
archive_entry_set_pathname(entry, buf); archive_entry_set_pathname(entry, buf);
rv = archive_read_extract(ar, entry, lflags); rv = archive_read_extract(ar, entry, lflags);
if (rv != 0 && rv != EEXIST) if (rv != 0 && errno != EEXIST)
break; break;
if ((rv = xbps_file_exec(buf, destdir, "pre", if ((rv = xbps_file_exec(buf, destdir, "pre",
@ -222,12 +222,12 @@ unpack_archive_fini(struct archive *ar, const char *destdir, int flags,
* Extract all data from the archive now. * Extract all data from the archive now.
*/ */
rv = archive_read_extract(ar, entry, lflags); rv = archive_read_extract(ar, entry, lflags);
if (rv != 0 && rv != EEXIST) { if (rv != 0 && errno != EEXIST) {
printf("ERROR: couldn't unpack %s (%s), exiting!\n", printf("ERROR: couldn't unpack %s (%s), exiting!\n",
archive_entry_pathname(entry), strerror(errno)); archive_entry_pathname(entry), strerror(errno));
(void)fflush(stdout); (void)fflush(stdout);
break; break;
} else if (rv == EEXIST) { } else if (rv != 0 && errno == EEXIST) {
if (flags & XBPS_UNPACK_VERBOSE) { if (flags & XBPS_UNPACK_VERBOSE) {
printf("WARNING: ignoring existent path: %s.\n", printf("WARNING: ignoring existent path: %s.\n",
archive_entry_pathname(entry)); archive_entry_pathname(entry));