]> git.cworth.org Git - notmuch/commit
Setup the GMimeStream only when needed
authornstraz@redhat.com <nstraz@redhat.com>
Thu, 1 Apr 2010 13:47:21 +0000 (09:47 -0400)
committerCarl Worth <cworth@cworth.org>
Thu, 1 Apr 2010 21:27:01 +0000 (14:27 -0700)
commit685cfcc9e876e9c611d2cb03e8ebd417a7f165b7
tree18e1a2c6c8273ed8e4bc39d5c506979e81680b8e
parentb884ab2ef1b9e15b81d119089e64c2c0fa60012e
Setup the GMimeStream only when needed

I ran into this while looking at the vim plugin.  Vim's system() call
redirects output to a file and it was missing many of the part{ lines.

If stream_stdout is setup too early, it will overwrite the part start
when notmuch is redirected to a file.

Reviewed-by Carl Worth <cworth@cworth.org>: GMime is calling fseek
before every write to reset the FILE* to the position it believes is
correct based on the writes it has seen. Our code was getting
incorrect results because our GMime writes were interleaved with
non-GMime writes via printf.

The bug appears when writing to a file because it's seekable, but not
when writing to a pipe which is not.
notmuch-show.c