[pacman-dev] [PATCH] Sync data after writing to the local db

Nagy Gabor ngaba at bibl.u-szeged.hu
Sat Oct 30 09:01:09 EDT 2010


> This should hopefully reduce local db corruption issues.
> 
> Signed-off-by: Allan McRae <allan at archlinux.org>
> ---
>  lib/libalpm/be_local.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c
> index 4574bd4..cb12abb 100644
> --- a/lib/libalpm/be_local.c
> +++ b/lib/libalpm/be_local.c
> @@ -841,6 +841,7 @@ int _alpm_local_db_write(pmdb_t *db, pmpkg_t
> *info, pmdbinfrq_t inforeq) fprintf(fp, "\n");
>  		}
>  
> +		fdatasync(fileno(fp));
>  		fclose(fp);
>  		fp = NULL;
>  	}
> @@ -869,6 +870,8 @@ int _alpm_local_db_write(pmdb_t *db, pmpkg_t
> *info, pmdbinfrq_t inforeq) }
>  			fprintf(fp, "\n");
>  		}
> +
> +		fdatasync(fileno(fp));
>  		fclose(fp);
>  		fp = NULL;
>  	}

Wouldn't this cause a notable slow-down?

NG


More information about the pacman-dev mailing list