Changeset 9c858e56 in rtems for cpukit/pppd


Ignore:
Timestamp:
Jan 31, 2005, 10:21:19 PM (15 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
671edd96
Parents:
fa5dfe8
Message:

2005-01-31 Sergei Organov <osv@…>

PR 771/pppd

  • libnetworking/pppd/chat.c, libnetworking/pppd/rtemsmain.c: The fix committed to fix PR736 breaks pppd. chat.c should have its own static ttyfd for pppd to work correctly. The symptom is that second invokation of chat (for connect script) fails due to pppd_ttyfd set to -1 by previous chat invokation (for init script). In addition, this patch fixes leaving of dangling pointer in the abort_stbring[] by chat_send().
Location:
cpukit/pppd
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/pppd/chat.c

    rfa5dfe8 r9c858e56  
    164164static char *phone_num      = (char *) 0;
    165165static char *phone_num2     = (char *) 0;
    166 /* static */ int pppd_ttyfd;
     166static int ttyfd;
    167167static int timeout   = DEFAULT_CHAT_TIMEOUT;
    168168
     
    247247  /* initialize exit code */
    248248  exit_code = 0;
    249   pppd_ttyfd     = fd;
     249  ttyfd     = fd;
    250250
    251251  script=pScript;
     
    272272    }
    273273  }
    274   pppd_ttyfd = (int)-1;
     274  ttyfd = (int)-1;
    275275
    276276  return ( exit_code );
     
    279279void break_sequence()
    280280{
    281   tcsendbreak(pppd_ttyfd, 0);
     281  tcsendbreak(ttyfd, 0);
    282282}
    283283
     
    640640
    641641    if (abort_next) {
    642                 char *s1;
    643        
    644642                abort_next = 0;
    645643                if ( n_aborts < MAX_ABORTS ) {
     644                        char *s1;
    646645                        s1 = clean(s, 0);
    647                         if (( strlen(s1) <= strlen(s) ) && ( strlen(s1) <  sizeof(fail_buffer))) {
    648                                 abort_string[n_aborts++] = s1;
     646                        if (( strlen(s1) <= strlen(s) ) && ( strlen(s1) <  sizeof(fail_buffer)))
     647                                abort_string[n_aborts++] = s1;
     648                        else
     649                                free(s1);
    649650                }
    650                 free(s1);
    651         }
    652651                return;
    653652    }
     
    700699        while(tries)
    701700        {
    702             status = read(pppd_ttyfd, &c, 1);
     701            status = read(ttyfd, &c, 1);
    703702            switch (status) {
    704703                   case 1:
     
    716715  char ch = c;
    717716
    718   return(write(pppd_ttyfd, &ch, 1));
     717  return(write(ttyfd, &ch, 1));
    719718}
    720719
     
    792791    memset(temp2, 0, sizeof(temp2));
    793792
    794     tcgetattr(pppd_ttyfd, &tios);
     793    tcgetattr(ttyfd, &tios);
    795794    tios.c_cc[VMIN] = 0;
    796795    tios.c_cc[VTIME] = timeout*10/MAX_TIMEOUTS;
    797     tcsetattr(pppd_ttyfd, TCSANOW, &tios);
     796    tcsetattr(ttyfd, TCSANOW, &tios);
    798797               
    799798    string = clean(in_string, 0);
     
    808807
    809808    if (len == 0) {
    810                         return (1);
     809        free(string);
     810        return (1);
    811811    }
    812812
  • cpukit/pppd/rtemsmain.c

    rfa5dfe8 r9c858e56  
    7878static char ppp_devnam[MAXPATHLEN]; /* name of PPP tty (maybe ttypx) */
    7979
    80 /* int pppd_ttyfd;                      * Serial port file descriptor */
     80int pppd_ttyfd;                 /* Serial port file descriptor */
    8181int baud_rate;                  /* Actual bits/second for serial device */
    8282int hungup;                     /* terminal has been hung up */
Note: See TracChangeset for help on using the changeset viewer.