Fossil

Check-in [478ef4ca]
Login

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

Overview
Comment:Off-by-one error in the previous commit.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:478ef4ca5a4fc9e24160eba390a7968f261ce1b3
User & Date: drh 2015-02-07 19:52:27
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: 35ab16bc user: drh tags: trunk
19:52
Off-by-one error in the previous commit. check-in: 478ef4ca 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: bd600901 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs 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 ){