Problem/Question wrt. openlog()
Martin Schulze
joey@infodrom.org
Thu Dec 13 10:27:00 GMT 2001
Hi,
Russell Coker wrote:
> When openlog(3) is called it saves a pointer to a user-supplied string and
> does not copy the data from the string. This means that if the value of
> the data pointed to by ident in the calling code changes then the results of
> syslog() calls will also change! This is not documented, if this is desired
> functionality then it should be documented as such.
>
> However I think that this action is a bug and should be fixed in the code.
Ben Collins wrote:
> It makes no such stipulation, which means it is open to implementation.
> SUSv2 says this:
>
> The ident argument is a string that is prepended to every message.
>
>
> It says nothing more. So the interpretation could allow for a pointer,
> that may later be changed (as is the case for glibc), where you would
> need to insure the string never changes (strdup and free it yourself).
> In all likelyhood, glibc's behavior follows other implementations (such
> as BSD, SysV{Solaris}, etc.), which makes it correct in that it follows
> such conventions.
I'd also say that the behaviour is "strange", thus I thought I'd throw it in
here so you get a chance commenting and noticing this.
The entire conversation is found at http://bugs.debian.org/102350
Regards,
Joey
--
It's time to close the windows.
Please always Cc to me when replying to me on the lists.
More information about the Libc-alpha
mailing list