comparison src/process.c @ 44013:da239fc7bb6c

(wait_reading_process_input): Move variables `pname' and `pnamelen' down where they are used.
author Pavel Jan?k <Pavel@Janik.cz>
date Mon, 18 Mar 2002 18:21:25 +0000
parents 177616cff62b
children e2339254ba48
comparison
equal deleted inserted replaced
44012:48c58612a775 44013:da239fc7bb6c
4205 } 4205 }
4206 #ifdef NON_BLOCKING_CONNECT 4206 #ifdef NON_BLOCKING_CONNECT
4207 if (check_connect && FD_ISSET (channel, &Connecting)) 4207 if (check_connect && FD_ISSET (channel, &Connecting))
4208 { 4208 {
4209 struct Lisp_Process *p; 4209 struct Lisp_Process *p;
4210 struct sockaddr pname;
4211 int pnamelen = sizeof(pname);
4212 4210
4213 FD_CLR (channel, &connect_wait_mask); 4211 FD_CLR (channel, &connect_wait_mask);
4214 if (--num_pending_connects < 0) 4212 if (--num_pending_connects < 0)
4215 abort (); 4213 abort ();
4216 4214
4227 int xlen = sizeof(xerrno); 4225 int xlen = sizeof(xerrno);
4228 if (getsockopt(channel, SOL_SOCKET, SO_ERROR, &xerrno, &xlen)) 4226 if (getsockopt(channel, SOL_SOCKET, SO_ERROR, &xerrno, &xlen))
4229 xerrno = errno; 4227 xerrno = errno;
4230 } 4228 }
4231 #else 4229 #else
4232 /* If connection failed, getpeername will fail. */ 4230 {
4233 xerrno = 0; 4231 struct sockaddr pname;
4234 if (getpeername(channel, &pname, &pnamelen) < 0) 4232 int pnamelen = sizeof(pname);
4235 { 4233
4236 /* Obtain connect failure code through error slippage. */ 4234 /* If connection failed, getpeername will fail. */
4237 char dummy; 4235 xerrno = 0;
4238 xerrno = errno; 4236 if (getpeername(channel, &pname, &pnamelen) < 0)
4239 if (errno == ENOTCONN && read(channel, &dummy, 1) < 0) 4237 {
4238 /* Obtain connect failure code through error slippage. */
4239 char dummy;
4240 xerrno = errno; 4240 xerrno = errno;
4241 } 4241 if (errno == ENOTCONN && read(channel, &dummy, 1) < 0)
4242 xerrno = errno;
4243 }
4244 }
4242 #endif 4245 #endif
4243 if (xerrno) 4246 if (xerrno)
4244 { 4247 {
4245 XSETINT (p->tick, ++process_tick); 4248 XSETINT (p->tick, ++process_tick);
4246 p->status = Fcons (Qfailed, Fcons (make_number (xerrno), Qnil)); 4249 p->status = Fcons (Qfailed, Fcons (make_number (xerrno), Qnil));