Changeset d905bf in git


Ignore:
Timestamp:
Jul 27, 2011, 1:27:40 PM (13 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '38077648e7239f98078663eb941c3c979511150a')
Children:
47a616dc41a262aba8e9cab6aacb0bae06174469
Parents:
cca6025b5e2b8a20c6d6df8a3b127131e492594e
Message:
better error check with ssiClose

git-svn-id: file:///usr/local/Singular/svn/trunk@14351 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/ssiLink.cc

    rcca602 rd905bf  
    981981BOOLEAN ssiClose(si_link l)
    982982{
    983   ssiInfo *d = (ssiInfo *)l->data;
    984   if (d!=NULL)
    985   {
    986     if (d->r!=NULL) rKill(d->r);
    987     if (d->f_read!=NULL) fclose(d->f_read);
    988     if ((strcmp(l->mode,"tcp")==0)
    989     || (strcmp(l->mode,"fork")==0))
    990     {
    991       link_list hh=ssiToBeClosed;
    992       if (hh!=NULL)
    993       {
    994         if (hh->l==l)
     983  if (l!=NULL)
     984  {
     985    ssiInfo *d = (ssiInfo *)l->data;
     986    if (d!=NULL)
     987    {
     988      if (d->r!=NULL) rKill(d->r);
     989      if (d->f_read!=NULL) fclose(d->f_read);
     990      if ((strcmp(l->mode,"tcp")==0)
     991      || (strcmp(l->mode,"fork")==0))
     992      {
     993        link_list hh=ssiToBeClosed;
     994        if (hh!=NULL)
    995995        {
    996            ssiToBeClosed=(link_list)hh->next;
    997            omFreeSize(hh,sizeof(link_struct));
     996          if (hh->l==l)
     997          {
     998             ssiToBeClosed=(link_list)hh->next;
     999             omFreeSize(hh,sizeof(link_struct));
     1000          }
     1001          else while(hh!=NULL)
     1002          {
     1003            link_list hhh=(link_list)hh->next;
     1004            if (hhh->l==l)
     1005            {
     1006              hh->next=hhh->next;
     1007              omFreeSize(hhh,sizeof(link_struct));
     1008              break;
     1009            }
     1010            hh=(link_list)hh->next;
     1011          }
    9981012        }
    999         else while(hh!=NULL)
    1000         {
    1001           link_list hhh=(link_list)hh->next;
    1002           if (hhh->l==l)
    1003           {
    1004             hh->next=hhh->next;
    1005             omFreeSize(hhh,sizeof(link_struct));
    1006             break;
    1007           }
    1008           hh=(link_list)hh->next;
     1013        if (d->send_quit_at_exit)
     1014        { 
     1015          fputs("99\n",d->f_write);fflush(d->f_write);
    10091016        }
    10101017      }
    1011       if (d->send_quit_at_exit)
    1012       {
    1013         fputs("99\n",d->f_write);fflush(d->f_write);
    1014       }
    1015     }
    1016     if (d->f_write!=NULL) fclose(d->f_write);
    1017     if (d->pid!=0)
    1018     {
    1019       kill(d->pid,15);
    1020       waitpid(d->pid,NULL,WNOHANG);
    1021       kill(d->pid,9); // just to be sure
    1022       waitpid(d->pid,NULL,0);
    1023     }
    1024     omFreeSize((ADDRESS)d,(sizeof *d));
    1025   }
    1026   l->data=NULL;
    1027   SI_LINK_SET_CLOSE_P(l);
     1018      if (d->f_write!=NULL) fclose(d->f_write);
     1019      if (d->pid!=0)
     1020      {
     1021        kill(d->pid,15);
     1022        waitpid(d->pid,NULL,WNOHANG);
     1023        kill(d->pid,9); // just to be sure
     1024        waitpid(d->pid,NULL,0);
     1025      }
     1026      omFreeSize((ADDRESS)d,(sizeof *d));
     1027    }
     1028    l->data=NULL;
     1029    SI_LINK_SET_CLOSE_P(l);
     1030  }
    10281031  return FALSE;
    10291032}
Note: See TracChangeset for help on using the changeset viewer.