[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
find_and_load() may load different file than stat()'ed
From: |
Martin Husemann |
Subject: |
find_and_load() may load different file than stat()'ed |
Date: |
Sun, 29 Aug 2004 08:40:33 +0200 |
User-agent: |
Mutt/1.4.2.1i |
Hi folks,
I found a reproducable way in the NetBSD build when creating info for
a cross-gdb (this is optional when cross compiling NetBSD, so the problem
went unnoticed some time). I've reported the bug as a NetBSD PR:
http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=26791
I think what happens is that makeinfo/node.c:split_file() uses stat() to
determine the file_size variable and then calls find_and_load() with use_path
= 1, and this finds a different sized (older) file with the same name (due to
the way makeinfo is invoked). Later, when accessing data beyound the loaded
size.
I worked around it by changing the call to find_and_load() to not use the
path (see attached patch). I suspect the right fix, however - or something
that should be done additionally - would be to change find_and_load() to
char *find_and_load (char *filename, int use_path, off_t *loaded_size);
and while there clean up all mis-uses of "long" for file size values ;-}
Martin
- find_and_load() may load different file than stat()'ed,
Martin Husemann <=