Fossil SCM

Off-by-one error in the previous commit.

drh 2015-02-07 19:52 trunk
Commit 478ef4ca5a4fc9e24160eba390a7968f261ce1b3
1 file changed +1 -1
+1 -1
--- src/main.c
+++ src/main.c
@@ -691,11 +691,11 @@
691691
zCmdName = g.argv[1];
692692
}
693693
#ifndef _WIN32
694694
/* Make sure open() will not return file descriptor 2. */
695695
{ int nTry = 0;
696
- while( !is_valid_fd(2) && nTry++ < 2 && open("/dev/null",O_WRONLY)>0 ){}
696
+ while( !is_valid_fd(2) && nTry++ < 2 && open("/dev/null",O_WRONLY)>=0 ){}
697697
if( !is_valid_fd(2) ){
698698
fossil_fatal("file descriptor 2 is not open");
699699
}
700700
}
701701
#endif
702702
--- src/main.c
+++ src/main.c
@@ -691,11 +691,11 @@
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
--- src/main.c
+++ src/main.c
@@ -691,11 +691,11 @@
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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button