bug-glibc
[Top][All Lists]
Advanced

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

readdir in static binaries (glibc-2.3.1)


From: Clifford Wolf
Subject: readdir in static binaries (glibc-2.3.1)
Date: Thu, 17 Oct 2002 03:17:58 +0200 (CEST)

Hi,

the following is with glibc-2.3.1 and gcc-3.2 on linux-2.4.19.

While debugging a problem with ldconfig I've found the this bug: For some
reason readdir() always returns NULL if the binary is built statically.
The following program

        #include <stdio.h>
        #include <dirent.h>

        int main() {
                DIR *dir;
                struct dirent *entry;

                dir=opendir("/");
                while ( (entry = readdir(dir)) != NULL ) {
                        printf("%s\n", entry->d_name);
                }
                closedir(dir);
                return 0;
        }

works fine if built with 'gcc -o demo demo.c'. But if I build exactly
the same program with 'gcc -static -o demo demo.c' I only get an empty
output.

Adding an additional printf at the end of the program shows that stdout
is working fine (i.e. buffers are flushed correctly).

This problem makes 'ldconfig' not finding any libraries here.

yours,
 - clifford

-- 
| Clifford Wolf ............ www.clifford.at . . . IRC: openprojects.net
| ROCK Linux Workgroup ..... www.rocklinux.org . . Tel: +43-699-10063494
| NTx Consulting Group ..... www.ntx.at  . . . . . Fax: +43-2235-42788-4
+------=[ Usenet Compliant Signature (RFC 2646) ]=---> www.rocklinux.net

Linux is a wigwam: No Windows, No Gates, Apache inside.

Reality corrupted. Reboot universe? (Y/N)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]