Changeset 860 for branches/prototype-v0/zoo-project/zoo-kernel/sshapi.c
- Timestamp:
- Dec 12, 2017, 4:09:47 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/prototype-v0/zoo-project/zoo-kernel/sshapi.c
r854 r860 283 283 } 284 284 }while(!sftp_handle); 285 #ifdef SSH_DEBUG 285 286 fprintf(stderr, "libssh2_sftp_open() is done, get file information\n"); 287 #endif 286 288 do { 287 289 rc = libssh2_sftp_stat_ex(sessions[cnt]->sftp_session, targetPath, strlen(targetPath), … … 295 297 else 296 298 { 299 #ifdef SSH_DEBUG 297 300 fprintf(stderr, "Stat Data: RetCode=%d\n", rc); 298 301 fprintf(stderr, "Stat Data: Size=%llu\n", attrs.filesize); 299 302 fprintf(stderr, "Stat Data: Perm=%lx\n", attrs.permissions); 300 303 fprintf(stderr, "Stat Data: mtime=%lu\n", attrs.mtime); 304 #endif 301 305 if(rc==0) 302 306 break; … … 348 352 return false; 349 353 } 354 if(!sessions[cnt]->sftp_session) 355 zSleep(10); 350 356 } while (!sessions[cnt]->sftp_session); 351 357 … … 363 369 return false; 364 370 } 371 if(!sftp_handle) 372 zSleep(10); 365 373 } while (!sftp_handle); 366 374 start = time(NULL); … … 432 440 return -1; 433 441 } 442 if(!sessions[cnt]->sftp_session) 443 zSleep(10); 434 444 } while (!sessions[cnt]->sftp_session); 435 445 do { … … 482 492 return -1; 483 493 } 484 494 485 495 } while (1); 486 496 duration = (int)(time(NULL)-start); … … 503 513 int exitcode; 504 514 char *exitsignal=(char *)"none"; 505 fprintf(stderr,"%s %d\n",__FILE__,__LINE__);506 fflush(stderr);507 515 while( (channel = libssh2_channel_open_session(sessions[cnt]->session)) == NULL && 508 516 libssh2_session_last_error(sessions[cnt]->session,NULL,NULL,0) == LIBSSH2_ERROR_EAGAIN ) { 509 fprintf(stderr,"%s %d\n",__FILE__,__LINE__); 510 fflush(stderr); 511 waitsocket(sessions[cnt]->sock_id, sessions[cnt]->session); 512 } 513 fprintf(stderr,"%s %d\n",__FILE__,__LINE__); 514 fflush(stderr); 517 waitsocket(sessions[cnt]->sock_id, sessions[cnt]->session); 518 } 515 519 if( channel == NULL ){ 516 520 fprintf(stderr,"Error\n"); 517 521 return -1; 518 522 } 519 fprintf(stderr,"%s %d\n",__FILE__,__LINE__);520 fflush(stderr);521 523 while( (rc = libssh2_channel_exec(channel, command)) == LIBSSH2_ERROR_EAGAIN ) { 522 fprintf(stderr,"%s %d\n",__FILE__,__LINE__);523 fflush(stderr);524 524 waitsocket(sessions[cnt]->sock_id, sessions[cnt]->session); 525 525 } 526 fprintf(stderr,"%s %d\n",__FILE__,__LINE__);527 fflush(stderr);528 526 if( rc != 0 ) { 529 527 fprintf(stderr,"Error\n"); 530 528 return -1; 531 529 } 532 fprintf(stderr,"%s %d\n",__FILE__,__LINE__);533 fflush(stderr);534 530 535 531 map* tmpPath=getMapFromMaps(conf,"main","tmpPath"); … … 539 535 FILE* logFile=fopen(logPath,"wb"); 540 536 free(logPath); 541 fprintf(stderr,"%s %d\n",__FILE__,__LINE__);542 fflush(stderr);543 537 while(true){ 544 538 int rc; … … 563 557 break; 564 558 } 565 fprintf(stderr,"%s %d\n",__FILE__,__LINE__);566 fflush(stderr);567 559 fclose(logFile); 568 fprintf(stderr,"%s %d\n",__FILE__,__LINE__);569 fflush(stderr);570 560 exitcode = 127; 571 fprintf(stderr,"%s %d\n",__FILE__,__LINE__);572 fflush(stderr);573 561 while( (rc = libssh2_channel_close(channel)) == LIBSSH2_ERROR_EAGAIN ) 574 562 waitsocket(sessions[cnt]->sock_id, sessions[cnt]->session); 575 fprintf(stderr,"%s %d\n",__FILE__,__LINE__);576 fflush(stderr);577 563 578 564 if( rc == 0 ) { … … 581 567 NULL, NULL, NULL, NULL, NULL); 582 568 } 583 fprintf(stderr,"%s %d\n",__FILE__,__LINE__);584 fflush(stderr);585 569 586 570 if (exitsignal) … … 588 572 else 589 573 fprintf(stderr, "\nEXIT: %d bytecount: %d\n", exitcode, bytecount); 590 fprintf(stderr,"%s %d\n",__FILE__,__LINE__);591 fflush(stderr);592 574 593 575 libssh2_channel_free(channel); … … 664 646 } 665 647 } 666 #ifdef DEBUG648 #ifdef SSH_DEBUG 667 649 fprintf(stderr,"%s %d\n",__FILE__,__LINE__); 668 650 fflush(stderr); … … 682 664 return false; 683 665 } 684 #ifdef DEBUG666 #ifdef SSH_DEBUG 685 667 fprintf(stderr,"*** %s %d\n",__FILE__,__LINE__); 686 668 fflush(stderr); … … 700 682 getMapArray(queueMaps->content,"targetPath",i) 701 683 }; 684 #ifdef SSH_DEBUG 702 685 fprintf(stderr,"*** %s %d %s %s\n",__FILE__,__LINE__,argv[1]->value,argv[2]->value); 686 #endif 703 687 /**/zooLock* lck; 704 688 if((lck=lockFile(*conf,argv[1]->value,'w'))!=NULL){/**/
Note: See TracChangeset
for help on using the changeset viewer.