Skip to content
  • Ross Lagerwall's avatar
    fuse: Track the size of open files properly · 3800f529
    Ross Lagerwall authored
    Previously, if a getattr() for an open file could not get the size
    information, the file position was returned as the size.  This is
    incorrect if seek or ftruncate had previously been used on the stream.
    
    Instead, track the size of the open file and return this value.  In
    addition, use this size in preference to the size returned by
    g_file_query_info() if a stream is open (this only happens if the stream
    doesn't support g_file_query_info_on_write()) since the tracked size is
    more likely to be correct due to implementing g_file_replace by writing
    to a temporary file.  Tracking the size is only necessary for files
    which are created or opened with O_TRUNC since files opened with
    O_APPEND will be appended in-place.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=632296
    3800f529