From 5a2348e5029574e38fc85c58f9417ce57f53fea0 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Tue, 18 Aug 2009 22:50:29 +0200 Subject: [PATCH] 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 --- lib/unpack.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/unpack.c b/lib/unpack.c index 3cc10e09..570736af 100644 --- a/lib/unpack.c +++ b/lib/unpack.c @@ -89,23 +89,23 @@ xbps_unpack_binary_pkg(prop_dictionary_t pkg, bool essential) * If installation of package was successful, make sure the package * 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 (fsync(pkg_fd) == -1) { + rv = errno; + goto out3; + } /* * Set package state to unpacked. */ rv = xbps_set_pkg_state_installed(pkgname, XBPS_PKG_STATE_UNPACKED); } +out3: + archive_read_finish(ar); +out2: + (void)close(pkg_fd); +out: + free(binfile); return rv; }