Package: libc6
Version: 2.3.2.ds1-18
Severity: normal

The output of the following program is:
"
[EMAIL PROTECTED]:~/src/test$ ./a.out
fseek: Unknown error 12345
"

Since I set errno to 12345 before making the (failing) fseek() call,
fseek() itself apparently fails without setting errno.

Here's the strace output between opening the file and failing:
"
open("/proc/self/mem", O_RDONLY)        = 3
fstat64(3, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0xb7fe8000
_llseek(3, 18446744072635807744, [3526037055030344891], SEEK_SET) = -1073743872
dup(2)                                  = 4
fcntl64(4, F_GETFL)                     = 0x2 (flags O_RDWR)
fstat64(4, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 5), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0xb7fe7000
_llseek(4, 0, 0xbffff768, SEEK_CUR)     = -1 ESPIPE (Illegal seek)
write(4, "fseek: Unknown error 12345\n", 27fseek: Unknown error 12345
) = 27
"

And the program itself:

"
/* The point of this program is to try to access one of its own local
 * variables by reading it from /proc/self/mem. */

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>

int main(int argc, char *argv[])
{
  int variable = 42;
  int readvalue = 0;
  FILE *mem = fopen("/proc/self/mem", "r");
  
  errno = 12345;
  if (fseek(mem, (size_t)&variable, SEEK_SET) != 0) {
    perror("fseek");
    exit(EXIT_FAILURE);
  }
  
  if (fread(&readvalue, sizeof(variable), 1, mem) != 1) {
    perror("fread");
    exit(EXIT_FAILURE);
  }
  
  printf("Localvar=%d, read value=%d\n", variable, readvalue);
  
  return 0;
}
"

-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (990, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.6.9-1-686
Locale: LANG=sv_SE, LC_CTYPE=sv_SE (charmap=ISO-8859-1)

Versions of packages libc6 depends on:
ii  libdb1-compat                 2.1.3-7    The Berkeley database routines [gl

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to