int create_user(const char *name, User **user_ptr_add) {
    User *this_user = malloc(sizeof(User));
    this_user->next = NULL;
    this_user->first_post = NULL;

    /* Need to check if name can be fully copied over. */
    if (strlen(name) > sizeof(this_user->name) - 1) {
        return 2;}
    
    /* Case 1: I am the first user. user_ptr_add is NULL? the linked list is empty. */
    if (*user_ptr_add == NULL) {
        strncpy(this_user->name, name, sizeof(this_user->name));
        this_user->name[31] = '\0';
        *user_ptr_add = this_user;
        return 0;
    }
    /* Case 2: linked list already contains users. */
    User *curr = *user_ptr_add;
    /* Find the last node <- its next is NULL. */
    while (curr->next != NULL) {
        /* Check for duplicate names. */
        if (strcmp(curr->name, name) == 0) {
            return 1;
        } curr = curr->next;
    } curr->next = this_user;
    strncpy(this_user->name, name, sizeof(this_user->name));
    this_user->name[31] = '\0';

    return 0;
}
Create a new user with the given name. Insert it at the tail of the list of users whose head is pointed to by *user_ptr_add. Return: - 0 if successful - 1 if a user by this name already exists in this list - 2 if the given name cannot fit in the 'name' array (don't forget about the null terminator)

However, my code is failing in the case where the name is already in the list. I think the while loop is not working. It does not loop from the head of the linked list. 