Changeset 317 for trunk/src/sh_calls.c


Ignore:
Timestamp:
Mar 15, 2011, 8:54:21 PM (14 years ago)
Author:
katerina
Message:

Further refinements for lstat in subprocess (ticket #236).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sh_calls.c

    r315 r317  
    242242}
    243243
     244static int sh_enable_use_sub = 0;
     245
     246#if defined (SH_WITH_CLIENT) || defined (SH_STANDALONE)
     247static int sh_use_sub = 1;
     248#else
    244249static int sh_use_sub = 0;
     250#endif
     251
     252void sh_calls_enable_sub()
     253{
     254  sh_enable_use_sub = 1;
     255  return;
     256}
    245257
    246258int sh_calls_set_sub (const char * str)
    247259{
    248   return sh_util_flagval(str, &sh_use_sub);
     260  int ret = sh_util_flagval(str, &sh_use_sub);
     261
     262  if ((ret == 0) && (!sh_use_sub))
     263    {
     264      sh_kill_sub();
     265    }
     266  return ret;
     267}
     268
     269long int retry_lstat_ns(const char * file, int line,
     270                        const char *file_name, struct stat *buf)
     271{
     272  int error;
     273  long int val_retry = -1;
     274  char errbuf[SH_ERRBUF_SIZE];
     275 
     276  SL_ENTER(_("retry_lstat_ns"));
     277
     278  do {
     279    val_retry = /*@-unrecog@*/lstat (file_name, buf)/*@+unrecog@*/;
     280  } while (val_retry < 0 && errno == EINTR);
     281
     282  error = errno;
     283  if (val_retry < 0) {
     284      (void) sh_error_message(error, aud_err_message, 64);
     285      sh_error_handle ((-1), file, line, error, MSG_ERR_LSTAT,
     286                       sh_error_message(error, errbuf, sizeof(errbuf)),
     287                       file_name );
     288  }
     289  errno = error;   
     290
     291  SL_RETURN(val_retry, _("retry_lstat_ns"));
    249292}
    250293
     
    258301  SL_ENTER(_("retry_lstat"));
    259302
    260   if (sh_use_sub)
     303  if (sh_use_sub && sh_enable_use_sub)
    261304    {
    262305      val_retry = sh_sub_lstat (file_name, buf);
     
    290333  SL_ENTER(_("retry_stat"));
    291334
    292   if (sh_use_sub)
     335  if (sh_use_sub && sh_enable_use_sub)
    293336    {
    294337      val_retry = sh_sub_stat (file_name, buf);
Note: See TracChangeset for help on using the changeset viewer.