Hello I'm trying to copy a character pointer into another character pointer. I currently have
static char *my_kstrdup(const char *buf)
{
char *ptr, *ret;
ret = ptr = kmalloc(strlen(buf));
if(ptr = NULL)
panic("kmalloc returned NULL");
for(; *buf != '\0'; ++ptr, ++buf)
*ptr = *buf;
*ptr = '\0';
return ret;
}
it seems to be crashing with the for loop, any advice?