Changeset 113
- Timestamp:
- 08/20/07 04:22:59 (1 year ago)
- Files:
-
- branches/eric/Libs/SSHAgent.m (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/eric/Libs/SSHAgent.m
r112 r113 246 246 - (void)handleAgentConnections 247 247 { 248 NS Task *currentAgent = agentTask;248 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 249 249 250 250 /* Fill the sockaddr_un structs. */ … … 264 264 NSLog(@"handleAgentConnections: socket() failed"); 265 265 [self stop]; 266 [pool release]; 266 267 return; 267 268 } … … 275 276 NSLog(@"handleAgentConnections: bind() failed"); 276 277 [self stop]; 278 [pool release]; 277 279 return; 278 280 } … … 284 286 NSLog(@"handleAgentConnections: listen() failed"); 285 287 [self stop]; 288 [pool release]; 286 289 return; 287 290 } … … 295 298 NSLog(@"handleAgentConnections: malloc() failed"); 296 299 [self stop]; 300 [pool release]; 297 301 return; 298 302 } … … 311 315 while ((result = select(largestFileDescriptor + 1, &readFileDescriptors, NULL, NULL, NULL))) 312 316 { 313 if (agentTask != currentAgent) {314 NSLog(@"handleAgentConnections: Hmmm our agent has gone away, close shop and hope the next one is up and running");315 [self stop];316 free(allFileDescriptors);317 return;318 }319 317 if (result == -1 && errno == EINTR) 320 318 continue; … … 326 324 [self stop]; 327 325 free(allFileDescriptors); 326 [pool release]; 328 327 return; 329 328 } … … 343 342 NSLog(@"handleAgentConnections: realloc() failed"); 344 343 [self stop]; 344 [pool release]; 345 345 return; 346 346 } … … 359 359 [self stop]; 360 360 free(allFileDescriptors); 361 [pool release]; 361 362 return; 362 363 } … … 371 372 [self stop]; 372 373 free(allFileDescriptors); 374 [pool release]; 373 375 return; 374 376 } … … 466 468 467 469 free(allFileDescriptors); 470 [pool release]; 468 471 } 469 472 … … 471 474 - (void)inputFromClient:(id)object 472 475 { 476 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 477 473 478 int destinationFileDescriptor = [[object objectAtIndex:0] intValue]; 474 479 const char *readBuffer = [[object objectAtIndex:1] cString]; … … 504 509 write(sourceFileDescriptor, "\0\0\0\5\2\0\0\0\0", 9); 505 510 511 [pool release]; 506 512 return; 507 513 } … … 512 518 write(sourceFileDescriptor, "\0\0\0\5\f\0\0\0\0", 9); 513 519 520 [pool release]; 514 521 return; 515 522 } … … 526 533 /* Write the buffer to the agent. */ 527 534 write(destinationFileDescriptor, readBuffer, len); 535 [pool release]; 528 536 } 529 537
