Changeset 399 for trunk/src


Ignore:
Timestamp:
Mar 27, 2012, 10:12:22 PM (13 years ago)
Author:
katerina
Message:

Fix for ticket #296 (sh_processes_readps may hang with EAGAIN).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sh_processcheck.c

    r398 r399  
    553553  SL_RETURN((0), _("sh_prochk_set_psarg"));
    554554#else
     555  (void) str;
    555556  sh_prochk_psarg = NULL;
    556557  SL_RETURN((-1), _("sh_prochk_set_psarg"));
     
    868869  char c;
    869870  unsigned int  pos = 0;
     871#define SH_TWAIT_MAX 60
     872  volatile unsigned int  twait = 0;
    870873  char tstr[256];
    871874  enum { SKIP_TO_WS, SKIP_WS, SKIP_TO_WS2, SKIP_WS2, GET_NUM, SKIP_END, GET_NUM2 } line;
     
    891894              break;
    892895            }
    893           else if (errno == EAGAIN)
     896          else if ((errno == EAGAIN) && (twait < SH_TWAIT_MAX))
    894897            {
    895898              clearerr(in);
     899              retry_msleep(1, 0);
     900              ++twait;
    896901              continue;
    897902            }
Note: See TracChangeset for help on using the changeset viewer.