Fossil SCM
Improvements to detections and attempted mitigation of the file-descriptor 2 not open problem sometimes seen with stunnel4.
Commit
bd60090134eead7237be4e9d409be2ece0b80e42
Parent
2a7c0282fe3bf7e…
1 file changed
+3
-2
+3
-2
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -691,12 +691,13 @@ | ||
| 691 | 691 | zCmdName = g.argv[1]; |
| 692 | 692 | } |
| 693 | 693 | #ifndef _WIN32 |
| 694 | 694 | /* Make sure open() will not return file descriptor 2. */ |
| 695 | 695 | { int nTry = 0; |
| 696 | - while( !is_valid_fd(2) && nTry++ < 2 ){ | |
| 697 | - open("/dev/null", O_WRONLY); | |
| 696 | + while( !is_valid_fd(2) && nTry++ < 2 && open("/dev/null",O_WRONLY)>0 ){} | |
| 697 | + if( !is_valid_fd(2) ){ | |
| 698 | + fossil_fatal("file descriptor 2 is not open"); | |
| 698 | 699 | } |
| 699 | 700 | } |
| 700 | 701 | #endif |
| 701 | 702 | rc = name_search(zCmdName, aCommand, count(aCommand), FOSSIL_FIRST_CMD, &idx); |
| 702 | 703 | if( rc==1 ){ |
| 703 | 704 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -691,12 +691,13 @@ | |
| 691 | zCmdName = g.argv[1]; |
| 692 | } |
| 693 | #ifndef _WIN32 |
| 694 | /* Make sure open() will not return file descriptor 2. */ |
| 695 | { int nTry = 0; |
| 696 | while( !is_valid_fd(2) && nTry++ < 2 ){ |
| 697 | open("/dev/null", O_WRONLY); |
| 698 | } |
| 699 | } |
| 700 | #endif |
| 701 | rc = name_search(zCmdName, aCommand, count(aCommand), FOSSIL_FIRST_CMD, &idx); |
| 702 | if( rc==1 ){ |
| 703 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -691,12 +691,13 @@ | |
| 691 | zCmdName = g.argv[1]; |
| 692 | } |
| 693 | #ifndef _WIN32 |
| 694 | /* Make sure open() will not return file descriptor 2. */ |
| 695 | { int nTry = 0; |
| 696 | while( !is_valid_fd(2) && nTry++ < 2 && open("/dev/null",O_WRONLY)>0 ){} |
| 697 | if( !is_valid_fd(2) ){ |
| 698 | fossil_fatal("file descriptor 2 is not open"); |
| 699 | } |
| 700 | } |
| 701 | #endif |
| 702 | rc = name_search(zCmdName, aCommand, count(aCommand), FOSSIL_FIRST_CMD, &idx); |
| 703 | if( rc==1 ){ |
| 704 |