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; }
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).