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:
		
							
								
								
									
										20
									
								
								lib/unpack.c
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								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; | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user