Просмотр исходного кода

update-alternatives: fsync the administrative files before installation

This is for filesystems that do not put an implicit write barrier
when renaming files. That way we ensure that we'll never
have empty files.
Raphaël Hertzog лет назад: 15
Родитель
Сommit
0e0e26cb8e
2 измененных файлов с 5 добавлено и 0 удалено
  1. 3 0
      debian/changelog
  2. 2 0
      utils/update-alternatives.c

+ 3 - 0
debian/changelog

@@ -5,6 +5,9 @@ dpkg (1.16.1) UNRELEASED; urgency=low
     due to this.
   * Improved description of --search in dpkg-query(1). Closes: #621066
     Thanks to Lars Buitinck <larsmans@gmail.com> for the patch.
+  * Let update-alternatives fsync() its administrative files before
+    moving them in place to avoid empty files with some filesystems.
+    LP: #344019
 
   [ Guillem Jover ]
   * Install deb-src-control(5) man pages in dpkg-dev. Closes: #620520

+ 2 - 0
utils/update-alternatives.c

@@ -1360,6 +1360,8 @@ alternative_save(struct alternative *a)
 	altdb_print_line(&ctx, "");
 
 	/* Close database file */
+	if (fsync(fileno(ctx.fh)))
+		syserr(_("unable to sync file '%s'"), ctx.filename);
 	if (fclose(ctx.fh))
 		syserr(_("unable to close file '%s'"), ctx.filename);