Check-in [478ef4ca5a]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Off-by-one error in the previous commit.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 478ef4ca5a4fc9e24160eba390a7968f261ce1b3
User & Date: drh 2015-02-07 19:52:27.328
Context
2015-02-07
20:40
Put the output into CGI or inetd mode prior to failing with a "file-descriptor 2 not open" error. check-in: 35ab16bc9e user: drh tags: trunk
19:52
Off-by-one error in the previous commit. check-in: 478ef4ca5a user: drh tags: trunk
19:48
Improvements to detections and attempted mitigation of the file-descriptor 2 not open problem sometimes seen with stunnel4. check-in: bd60090134 user: drh tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/main.c.
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
      g.argv = zNewArgv;
    }
    zCmdName = g.argv[1];
  }
#ifndef _WIN32
  /* Make sure open() will not return file descriptor 2. */
  { int nTry = 0;
    while( !is_valid_fd(2) && nTry++ < 2 && open("/dev/null",O_WRONLY)>0 ){}
    if( !is_valid_fd(2) ){
      fossil_fatal("file descriptor 2 is not open");
    }
  }
#endif
  rc = name_search(zCmdName, aCommand, count(aCommand), FOSSIL_FIRST_CMD, &idx);
  if( rc==1 ){







|







689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
      g.argv = zNewArgv;
    }
    zCmdName = g.argv[1];
  }
#ifndef _WIN32
  /* Make sure open() will not return file descriptor 2. */
  { int nTry = 0;
    while( !is_valid_fd(2) && nTry++ < 2 && open("/dev/null",O_WRONLY)>=0 ){}
    if( !is_valid_fd(2) ){
      fossil_fatal("file descriptor 2 is not open");
    }
  }
#endif
  rc = name_search(zCmdName, aCommand, count(aCommand), FOSSIL_FIRST_CMD, &idx);
  if( rc==1 ){