Bug 25442 - non-static data causes segfault in syslog
non-static data causes segfault in syslog
Product: Red Hat Linux
Classification: Retired
Component: glibc (Show other bugs)
i386 Linux
medium Severity high
: ---
: ---
Assigned To: Jakub Jelinek
Aaron Brown
Depends On:
  Show dependency treegraph
Reported: 2001-01-31 21:09 EST by Ian Pilcher
Modified: 2016-11-24 10:04 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2001-01-31 21:09:38 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Ian Pilcher 2001-01-31 21:09:35 EST
This may be a gcc problem; I'm not smart enough to tell . . .

Compiling/running a C program with 4 non-static global character pointers
causes a
segfault in any call to syslog.  See the example code in "Additional
Information."  If the
data is static, the segfault does not occur.

Reproducible: Always
Steps to Reproduce:
1.  Compile the example program below.
2.  Run it.

Actual Results:  Segfault

Expected Results:  It shouldn't segfault

#include <syslog.h>

char *job, *host, *user, *time;

int main (int argc, const char *argv[])
    syslog (LOG_ERR, "error message");
    return 0;
Comment 1 Jakub Jelinek 2001-02-01 11:01:32 EST
This is fault on your side, you should not define time as global variable when
you call a function which calls time() because then libc calls resolves
time to your variable (that's how ELF symbol resolution works).

Note You need to log in before you can comment on or make changes to this bug.