[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Problems with lstat() and large files


I'm having some problems with lstat() on debian stable and debian
testing with 2.4 kernels. A program that tries to do lstat on a file
bigger than 2gb gets an error. Has anyone else experienced this? I'm
running third party software that requires a functional ltrace(), and
doesn't handle this well.

The lstat() appears to work with on debian stable with a 2.2 kernel,
but I need 2.4 for hardware support etc.

I've tested on debian sarge as well, and I get the same results there.
Is this a known problem? Is there a known fix? The same program worked
fine on redhat 8.
Do I have to go back?

Here is a sample program. Compile like this:
$ gcc -o testlstat testlstat.c
and run like this
$ ./testlstat /path/to/largefile
and watch it fail with ltrace:
$ ltrace ./testlstat /path/to/largefile

-- testltstat.c --
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <stdio.h>
#include <error.h>
#include <errno.h>
#include <unistd.h>

int main (int argc, char * argv[]) {
  struct stat buf;
  if (lstat(argv[1], &buf) == -1) {
    printf("error: %s\n",strerror(errno));
    return 1;
  return 0;

Reply to: