how to fix friend_server.c:369:12: error: function returns address of local variable [-Werror=return-local-addr]
  369 |     return name;

char * check_and_add_user(User *user_list, int client_fd)
{
    char buf[INPUT_BUFFER_SIZE] = {'\0'};
    int inbuf = 0;          // How many bytes currently in buffer?
    int room = sizeof(buf); // How many bytes remaining in buffer?
    char *after = buf;      // Pointer to position after the data in buf
    char name[MAX_NAME];
    User *curr = user_list;

    int nbytes;
    while ((nbytes = read(client_fd, after, room)) > 0)
    {
        inbuf += nbytes;
        int where;
        while ((where = find_network_newline(buf, inbuf)) > 0)
        {
            buf[where - 2] = '\0';
            strcpy(name, buf);
            printf("test (name): %s\n", name);
            if (curr != NULL)
            {
                while (curr->next != NULL)
                {
                    if (strcmp(name, curr->name) == 0)
                    { // there is already a user with this name
                        write(client_fd, "Welcome Back\n", 13);
                        break;
                    }
                    curr = curr->next;
                }
                if (curr->next == NULL)
                { // create a new user
                    struct user *new_user = calloc(sizeof(User), 1);
                    strncpy(new_user->name, buf, MAX_NAME); // didn't malloc space for name, thus, it is read-only
                    strcat(new_user->name, "\r\n");
                    new_user->next = NULL;
                    curr->next = new_user;
                    printf("added_user succesfully, not first\n");
                }
            }
            else
            { // curr is NULL and the linkedlist is empty
                struct user *new_user = calloc(sizeof(User), 1);
                strncpy(new_user->name, buf, MAX_NAME);
                strcat(new_user->name, "\r\n");
                new_user->next = NULL;
                curr = new_user;
                printf("added_user succesfully, first\n");
            }
            inbuf = inbuf - where;
            for (int i = 0; i < where; i++)
            {
                buf[i] = '\0';
            }
            memmove(buf, buf + where, inbuf);
            for (int i = where; i < INPUT_BUFFER_SIZE; i++)
            {
                buf[i] = '\0';
            }
        }
        after = buf + inbuf;
        room = INPUT_BUFFER_SIZE - inbuf;
        printf("check and add user complete \n");
        
    }
    return name;
}