It seems that function basename simply returns pointer within string literal "this/is/a/path.geo.bin" or even tries to change it.
However string literals may not be changed. Any attempt to change a string literal results in undefined behaviour. And function strtok
changes the string passed to it as an argument.
According to the C Standard (6.4.5 String literals)
7 It is unspecified whether these arrays are distinct provided their
elements have the appropriate values. If the program attempts to
modify such an array, the behavior is undefined.
Thus the program could look like
int main()
{
char name[] = "this/is/a/path.geo.bin";
char *token = strtok(basename( name ), ".");
if (token != NULL){
printf( " %s\n", token );
}
return(0);
}