[poppler] UniqueFileStream and deleted files

Ihar `Philips` Filipau thephilips at gmail.com
Sat Mar 23 10:43:42 PDT 2013


> (i tried to find a way to duplicate a FILE* but failed)

How did you duplicate FILE*?

How did the `fdopen( fileno(oldfile), mode )` failed?

On 3/23/13, Albert Astals Cid <aacid at kde.org> wrote:
> We have found a problem in Okular that with the new UniqueFileStream class
> that has been introduced for multi-threaded rendering we crash when we try
> to
> render a file that has been deleted on disk.
>
> This is because the UniqueFileStream::UniqueFileStream that we use to have
> different file pointers to read the xref, etc tries to reopen the file, but
>
> the file is gone and thus operations on it crash.
>
> One option would be just returning false but that would be a sad thing since
>
> we are losing support for a feature we had.
>
> Since we already have the file open we still ahve a vaild FILE that points
> to
> it, i'm suggesting that if in FileStream::copy we detect that the file is
> gone, we write it to a temporary location and keep using that one. It might
> be
> a bit slow the first time but can't think of other way of doing it (i tried
> to
> find a way to duplicate a FILE* but failed)
>
> Comments?
>
> Cheers,
>   Albert
> _______________________________________________
> poppler mailing list
> poppler at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/poppler
>


-- 
Don't walk behind me, I may not lead.
Don't walk in front of me, I may not follow.
Just walk beside me and be my friend.
    -- Albert Camus (attributed to)


More information about the poppler mailing list