On Tue, Feb 21, 2006 at 04:10:54PM +0200, Antti Salmela wrote:
> Tags: patch

> diff -ur prelink-0.0.20050901/src/cache.c prelink-0.0.20050901.new/src/cache.c
> --- prelink-0.0.20050901/src/cache.c    2004-10-01 22:29:08.000000000 +0300
> +++ prelink-0.0.20050901.new/src/cache.c        2006-02-21 15:56:33.000000000 
> +0200
> @@ -608,6 +608,7 @@
>    if (write (fd, &cache, sizeof (cache)) != sizeof (cache)
>        || write (fd, data, len) != len
>        || fchmod (fd, 0644)
> +      || fsync (fd)
>        || close (fd)
>        || rename (prelink_cache_tmp, prelink_cache))
>      {
> diff -ur prelink-0.0.20050901/src/dso.c prelink-0.0.20050901.new/src/dso.c
> --- prelink-0.0.20050901/src/dso.c      2005-07-18 14:15:39.000000000 +0300
> +++ prelink-0.0.20050901.new/src/dso.c  2006-02-21 15:57:17.000000000 +0200
> @@ -1601,6 +1601,8 @@
>      }
> 
>    elf_end (dso->elf);
> +  if (dso_is_rdwr (dso))
> +    fsync (dso->fd);
>    close (dso->fd);
>    if (dso->elfro)
>      {

Um, if you have to call fsync to ensure the filesystem does the write before
the rename, isn't that a filesystem bug?  I.e., isn't it a violation of
POSIX filesystem semantics for these ops to *not* be processed in order?

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
[EMAIL PROTECTED]                                   http://www.debian.org/

Attachment: signature.asc
Description: Digital signature

Reply via email to