[GRASS-SVN] r29473 - grass/trunk/lib/db/dbmi_client

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Dec 18 13:07:04 EST 2007


Author: glynn
Date: 2007-12-18 13:07:04 -0500 (Tue, 18 Dec 2007)
New Revision: 29473

Modified:
   grass/trunk/lib/db/dbmi_client/start.c
Log:
MSVC fixes (from J?\195?\188rgen E. Fischer):
 check for any negative return value, not just -1



Modified: grass/trunk/lib/db/dbmi_client/start.c
===================================================================
--- grass/trunk/lib/db/dbmi_client/start.c	2007-12-18 17:14:55 UTC (rev 29472)
+++ grass/trunk/lib/db/dbmi_client/start.c	2007-12-18 18:07:04 UTC (rev 29473)
@@ -143,8 +143,8 @@
          uses ReadFile to make more buffer space available.
          (Which does not seem to be true on NT 5.1)
     */
-    if( _pipe(p1, 250000, _O_BINARY) == -1 ||
-        _pipe(p2, 250000, _O_BINARY) == -1 ) 
+    if( _pipe(p1, 250000, _O_BINARY) < 0 ||
+        _pipe(p2, 250000, _O_BINARY) < 0 ) 
     {
         db_syserror ("can't open any pipes");
 	return (dbDriver *) NULL;
@@ -161,7 +161,7 @@
 
     have_stdin = have_stdout = 1;
 
-    if ( _fileno(stdin) == -1 ) 
+    if ( _fileno(stdin) < 0 ) 
     {
         have_stdin = 0;
         stdin_fd = 0; 
@@ -170,7 +170,7 @@
     {
         stdin_fd = _fileno(stdin);
 
-        if ( (stdin_orig  = _dup(_fileno(stdin ))) == -1  ) 
+        if ( (stdin_orig  = _dup(_fileno(stdin ))) < 0  ) 
         {
             db_syserror ("can't duplicate stdin");
 	    return (dbDriver *) NULL;
@@ -184,7 +184,7 @@
         return (dbDriver *) NULL;
     }
 
-    if ( _fileno(stdout) == -1 ) 
+    if ( _fileno(stdout) < 0 ) 
     {
         have_stdout = 0;
         stdout_fd = 1; 
@@ -193,7 +193,7 @@
     {
         stdout_fd = _fileno(stdout);
 
-        if ( (stdout_orig  = _dup(_fileno(stdout ))) == -1  ) 
+        if ( (stdout_orig  = _dup(_fileno(stdout ))) < 0 ) 
         {
             db_syserror ("can't duplicate stdout");
 	    return (dbDriver *) NULL;
@@ -219,7 +219,7 @@
      *    descriptors in driver (which is another problem)
      */
 
-     pid = _spawnl ( _P_NOWAIT, startup, "", NULL ); 
+     pid = _spawnl ( _P_NOWAIT, startup, startup, NULL ); 
     
     /* This does not help. It runs but pipe remains open when close() is 
      * called in model but caling close() on that descriptor in driver gives 



More information about the grass-commit mailing list