I have some code that works if I pass it a string literal but not a const char * or char *.
Fuck you C, why you so moody?
@jameschip you probably have some UB somewhere in that case, no? A literal should just be a char* pointing at .data
@syntacticsugarglider basically I am grabbing some text from a file, malloc it into a char * and pass it to nftw(3).
If I pass a string literal it works but with a malloced char* nothing.
I’ll post some code later but I’m with the kids now.
@jameschip I'm not a c expert but my assumption is naturally going to be that you mishandled your string ptr
@syntacticsugarglider I can print it fine just before I pass it and it had the expected content, but yeah there’s something going on.
So after this playing on my mind all day while playing with the kid I finally sat down to work out what was going on.
Tried to remember the GDB commands and bingo!
bloody newline!
That is the bug.