Bug 25442 - non-static data causes segfault in syslog
Summary: non-static data causes segfault in syslog
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: glibc
Version: 7.0
Hardware: i386
OS: Linux
medium
high
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Aaron Brown
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-02-01 02:09 UTC by Ian Pilcher
Modified: 2016-11-24 15:04 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2001-02-01 02:09:38 UTC
Embargoed:


Attachments (Terms of Use)

Description Ian Pilcher 2001-02-01 02:09:35 UTC
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 16:01:32 UTC
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.