[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: segfault when using freopen() after an ld preloaded wrapped fopen()
From: |
Manuel Arriaga |
Subject: |
Re: segfault when using freopen() after an ld preloaded wrapped fopen() |
Date: |
Tue, 2 Apr 2002 23:09:21 +0100 |
Hi Geert, all,
My name is Manuel Arriaga and I wrote libtrash --
http://www.m-arriaga.net/software/libtrash . libtrash is a piece of code
which, when preloaded, implements a "trash can" under GNU/Linux.
> When working on a sandbox solution using the ld preload mechanism, I
> came accross a weird behaviour. When creating a wrapper for fopen() and
> freopen() (wrapped or non-wrapped) is later used, libc segfaults on all
> the subsequent calls that use the newly returned FILE stream.
The problem you describe is precisely the cause of the misbehaviour which was
reported a few days ago concerning libtrash and mutt.
May I ask how you uncovered this problem? Exactly the same thing happens
inside mutt (any recent version): the file is opened without problems using a
preloaded fopen(), then freopened() (either through a wrapper or not), and,
afterwards, a call to ftell() causes a segmentation fault.
Using gdb I traced it down to line 63 of glibc-2.2.3/libio/ioseekoff.c
(that's the version I'm using). From that point on, I'm clueless.
Can anyone offer any advice/help/confirmation?
Best regards,
Manuel Arriaga