Bug 54359

Summary: perror prints bogus error (Illegal seek)
Product: [Retired] Red Hat Public Beta Reporter: Tobias Ringstrom <tobias>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: Aaron Brown <abrown>
Severity: medium Docs Contact:
Priority: medium    
Version: roswellCC: fweimer
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-10-04 18:19:24 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tobias Ringstrom 2001-10-04 18:19:20 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.4) Gecko/20010917

Description of problem:
The following program:

#include <stdio.h>
#include <errno.h>
int main() {
	errno = ECONNREFUSED;
	perror("");
	return 0;
}

should print "Connection refused", but prints "Illegal seek".

Version-Release number of selected component (if applicable):
glibc-2.2.4-11

How reproducible:
Always

Steps to Reproduce:
1. Run the program above.


Additional info:

Strace of the program:

...
open("/lib/i686/libc.so.6", O_RDONLY)   = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\320\305"..., 1024)
= 1024
fstat64(3, {st_mode=S_IFREG|0755, st_size=5771848, ...}) = 0
old_mmap(NULL, 1289832, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x40091000
mprotect(0x401c3000, 36456, PROT_NONE)  = 0
old_mmap(0x401c3000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3,
0x131000) = 0x401c3000
old_mmap(0x401c8000, 15976, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x401c8000
close(3)                                = 0
munmap(0x40017000, 79310)               = 0
dup(2)                                  = 3
fcntl64(0x3, 0x3, 0x3, 0)               = 2
brk(0)                                  = 0x80497c0
brk(0x8049940)                          = 0x8049940
brk(0x804a000)                          = 0x804a000
fstat64(3, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x40017000
_llseek(3, 0, 0xbfffeb30, SEEK_CUR)     = -1 ESPIPE (Illegal seek)
write(3, "Illegal seek\n", 13Illegal seek
)          = 13
close(3)                                = 0
munmap(0x40017000, 4096)                = 0
_exit(0)                                = ?

Comment 1 Bill Nottingham 2001-10-04 19:56:22 UTC
Fixed in glibc-2.2.4-13 and later.