bus error in strsep

Maxime Henrion mux at FreeBSD.org
Thu Jul 7 09:18:26 GMT 2005


Stefan Sperling wrote:
> On Wed, Jul 06, 2005 at 12:10:23PM -0700, Maksim Yevmenkin wrote:
> > Maksim Yevmenkin wrote:
> > >>    char *c = "whats:your:name:buddy?";
> > >
> > >        ^^^^^^^^^^^^^^^^ that is not read only copy. you can not write 
> > >        into it. replace it with
> > 
> > made type. that should read "that is read only copy" :)
> 
> Dark corners of C... So it's my own fault, as usual :)
> thanks a lot :)

Or you can be a bad guy and compile with GCC and -fwritable-strings so
that it puts the const string into a read-write section :-).  This is an
absolutely evil hack, of course.

Maxime


More information about the freebsd-hackers mailing list