On Wed, Apr 16, 2008 at 08:34:17PM +0100, Al Viro wrote:
Ugly ->index games, sigh...
Busybox just wants to estimate size of a file. And it knows about
zero-length /proc/*/stat .
libbb/read.c:
void *xmalloc_open_read_close(const char *filename, size_t *sizep)
{
char *buf;
size_t size = sizep ? *sizep : INT_MAX;
int fd;
off_t len;
fd = xopen(filename, O_RDONLY);
/* /proc/N/stat files report len 0 here */
/* In order to make such files readable, we add small const */
len = xlseek(fd, 0, SEEK_END) | 0x3ff; /* + up to 1k */
...
--