Changeset 6f70c07 in rtems


Ignore:
Timestamp:
Nov 30, 2009, 10:13:48 PM (9 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, master
Children:
0b0485ae
Parents:
4e545aaa
Message:

2009-11-30 Joel Sherrill <joel.sherrill@…>

  • libmisc/shell/login_prompt.c: Fix problem where timeout on login prompt at console results in tight loop repeating login prompt.
Location:
cpukit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    r4e545aaa r6f70c07  
     12009-11-30      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        * libmisc/shell/login_prompt.c: Fix problem where timeout on login
     4        prompt at console results in tight loop repeating login prompt.
     5
    162009-11-30      Sebastian Huber <sebastian.huber@embedded-brains.de>
    27
  • cpukit/libmisc/shell/login_prompt.c

    r4e545aaa r6f70c07  
    7171#include <unistd.h>
    7272#include <ctype.h>
     73#include <errno.h>
    7374
    7475#include <rtems/shell.h>
     
    99100  tcdrain( fd_in);
    100101  if (out != NULL){
    101     tcdrain( fileno( out));
     102    tcdrain( fileno(out) );
    102103  }
    103104
    104105  while (true) {
    105     int c = fgetc( in);
     106    int c = fgetc(in);
    106107
    107108    switch (c) {
    108109      case EOF:
     110        clearerr( in );
    109111        return false;
    110112      case '\n':
     
    139141    }
    140142  }
     143  return true;
    141144}
    142145
     
    148151)
    149152{
    150   int fd_in = fileno( in);
     153  int fd_in = fileno(in);
    151154  struct termios termios_previous;
    152155  bool restore_termios = false;
     
    169172    char passphrase [128];
    170173
    171     fprintf( out, "%s login: ", device);
    172     fflush( out);
    173     if ( !rtems_shell_get_text( in, out, user, sizeof( user)) )
     174    fprintf( out, "%s login: ", device );
     175    fflush( out );
     176    result = rtems_shell_get_text( in, out, user, sizeof(user) );
     177    if ( !result )
    174178      break;
    175179
     
    177181    fprintf( out, "Password: ");
    178182    fflush( out);
    179     if ( !rtems_shell_get_text( in, NULL, passphrase, sizeof( passphrase)) )
     183    result = rtems_shell_get_text( in, NULL, passphrase, sizeof(passphrase) );
     184    if ( !result )
    180185      break;
    181186    fputc( '\n', out);
    182187
    183     result = check( user, passphrase);
    184     if (result) {
     188    result = check( user, passphrase );
     189    if (result)
    185190      break;
    186     }
    187191
    188192    fprintf( out, "Login incorrect\n\n");
Note: See TracChangeset for help on using the changeset viewer.