rose->source_call = *user; 
rose->source_call = user->call; 
static int rose_connect(struct socket *sock, struct sockaddr *uaddr, int addr_len, int flags){	struct sock *sk = sock->sk;	struct rose_sock *rose = rose_sk(sk);	struct sockaddr_rose *addr = (struct sockaddr_rose *)uaddr;	unsigned char cause, diagnostic;	ax25_address *user;	struct net_device *dev;	int n;	if (sk->sk_state == TCP_ESTABLISHED && sock->state == SS_CONNECTING) {		sock->state = SS_CONNECTED;		return 0;	/* Connect completed during a ERESTARTSYS event */	}	if (sk->sk_state == TCP_CLOSE && sock->state == SS_CONNECTING) {		sock->state = SS_UNCONNECTED;		return -ECONNREFUSED;	}	if (sk->sk_state == TCP_ESTABLISHED)		return -EISCONN;	/* No reconnect on a seqpacket socket */	sk->sk_state   = TCP_CLOSE;	sock->state = SS_UNCONNECTED;	if (addr_len != sizeof(struct sockaddr_rose) && addr_len != sizeof(struct full_sockaddr_rose))		return -EINVAL;	if (addr->srose_family != AF_ROSE)		return -EINVAL;	if (addr_len == sizeof(struct sockaddr_rose) && addr->srose_ndigis > 1)		return -EINVAL;	if (addr->srose_ndigis > ROSE_MAX_DIGIS)		return -EINVAL;	/* Source + Destination digis should not exceed ROSE_MAX_DIGIS */	if ((rose->source_ndigis + addr->srose_ndigis) > ROSE_MAX_DIGIS)		return -EINVAL;	rose->neighbour = rose_get_neigh(&addr->srose_addr, &cause,					 &diagnostic);	if (!rose->neighbour)		return -ENETUNREACH;	rose->lci = rose_new_lci(rose->neighbour);	if (!rose->lci)		return -ENETUNREACH;	if (sock_flag(sk, SOCK_ZAPPED)) {	/* Must bind first - autobinding in this may or may not work */		sock_reset_flag(sk, SOCK_ZAPPED);		if ((dev = rose_dev_first()) == NULL)			return -ENETUNREACH;		if ((user = ax25_findbyuid(current->euid)) == NULL)			return -EINVAL;		memcpy(&rose->source_addr, dev->dev_addr, ROSE_ADDR_LEN);		rose->source_call = *user;		rose->device      = dev;		rose_insert_socket(sk);		/* Finish the bind */	}	rose->dest_addr   = addr->srose_addr;	rose->dest_call   = addr->srose_call;	rose->rand        = ((long)rose & 0xFFFF) + rose->lci;	rose->dest_ndigis = addr->srose_ndigis;	if (addr_len == sizeof(struct full_sockaddr_rose)) {		struct full_sockaddr_rose *full_addr = (struct full_sockaddr_rose *)uaddr;		for (n = 0 ; n < addr->srose_ndigis ; n++)			rose->dest_digis[n] = full_addr->srose_digis[n];	} else {		if (rose->dest_ndigis == 1) {			rose->dest_digis[0] = addr->srose_digi;		}	}	/* Move to connecting socket, start sending Connect Requests */	sock->state   = SS_CONNECTING;	sk->sk_state     = TCP_SYN_SENT;	rose->state = ROSE_STATE_1;	rose->neighbour->use++;	rose_write_internal(sk, ROSE_CALL_REQUEST);	rose_start_heartbeat(sk);	rose_start_t1timer(sk);	/* Now the loop */	if (sk->sk_state != TCP_ESTABLISHED && (flags & O_NONBLOCK))		return -EINPROGRESS;	/*	 * A Connect Ack with Choke or timeout or failed routing will go to	 * closed.	 */	if (sk->sk_state == TCP_SYN_SENT) {		struct task_struct *tsk = current;		DECLARE_WAITQUEUE(wait, tsk);		add_wait_queue(sk->sk_sleep, &wait);		for (;;) {			set_current_state(TASK_INTERRUPTIBLE);			if (sk->sk_state != TCP_SYN_SENT)				break;			if (!signal_pending(tsk)) {				schedule();				continue;			}			current->state = TASK_RUNNING;			remove_wait_queue(sk->sk_sleep, &wait);			return -ERESTARTSYS;		}		current->state = TASK_RUNNING;		remove_wait_queue(sk->sk_sleep, &wait);	}	if (sk->sk_state != TCP_ESTABLISHED) {		sock->state = SS_UNCONNECTED;		return sock_error(sk);	/* Always set at this point */	}	sock->state = SS_CONNECTED;	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/01d7dd0e9f8c5f1888619d2649c7da389232b408/af_rose.c/buggy/net/rose/af_rose.c