xbps_unpack_binary_pkg: switch back to fsync(), to be safe.

Move the set_pkg_state call just after the fsync call, otherwise
strange things can ocurr sometimes.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20090818205029-b01fqdf5tw4hnzgc
This commit is contained in:
Juan RP 2009-08-18 22:50:29 +02:00
parent c9d19c2da9
commit 5a2348e502

View File

@ -89,23 +89,23 @@ xbps_unpack_binary_pkg(prop_dictionary_t pkg, bool essential)
* If installation of package was successful, make sure the package * If installation of package was successful, make sure the package
* is really on storage (if possible). * is really on storage (if possible).
*/ */
if (rv == 0)
if (fdatasync(pkg_fd) == -1)
rv = errno;
out3:
archive_read_finish(ar);
out2:
(void)close(pkg_fd);
out:
free(binfile);
if (rv == 0) { if (rv == 0) {
if (fsync(pkg_fd) == -1) {
rv = errno;
goto out3;
}
/* /*
* Set package state to unpacked. * Set package state to unpacked.
*/ */
rv = xbps_set_pkg_state_installed(pkgname, rv = xbps_set_pkg_state_installed(pkgname,
XBPS_PKG_STATE_UNPACKED); XBPS_PKG_STATE_UNPACKED);
} }
out3:
archive_read_finish(ar);
out2:
(void)close(pkg_fd);
out:
free(binfile);
return rv; return rv;
} }