The function that calls dirname does this
Code: Select all
orig_name = "/usr//";
name = dirname(orig_name);
kprintf("%s\n", name);
GCC combines my 2 literal strings together so that the "/" occupies the last character and NULL of the "/usr//". This is of course not good for dirname because it modifies the "/usr//" thus trashing the "/" it would sometimes return.
These 2 strings are defined in different files so I'm not sure how GCC even manages to do this. Anyone seen this before ? Or have I misinterpreted the whole thing ?