Environment:
     Linux axis 2.6.19 #9 PREEMPT Mon Apr 6 15:44:03 EDT 2009 cris unknown

Sqlite:
     Sqlite: sqlite-3.6.14
   ./configure --host=cris-axis-linux-gnu 
  --prefix=/AEMDEV/83+/devboard-R2_10/target/cris-axis-linux-gnu 
--enable-static=yes --enable-shared=yes --disable-dynamic-extensions

Application:
     My application runs against the shared library built as above.

Code in my application fails after calling sqlite3_open().

This synopsis is of a function designed to spawn a shell, execute a 
command, and read back the result via a pipe of stdout.  It works fine, 
until sqlite3_open() is called anywhere PRIOR.

prior sqlite3_open() call:
     sqlite3 *dbf;
     sqlite3_open("/path/to/my.db", &dbf);


         fflush(stdout);
         pipe(fd);
         pid = fork();
         if (pid == 0)
         {
             dup2(fd[1], STDOUT_FILENO);
             dup2(fd[1], STDERR_FILENO);
             close(fd[0]);
             execl("/bin/sh", "sh", "-c", "echo 123", 0);
         }
         if (-1 == (flags = fcntl(fd[0], F_GETFL, 0)))
             flags = 0;
         fcntl(fd[0], F_SETFL, flags | O_NONBLOCK);

     .. within a loop:

         got=read(fd[0], buf, sizeof(buf));
         if (got>-1)
         {
             snprintf(cValue,4,"%s",buf);
             break;
         }
         // got ==-1



When sqlite3_open() is called as above, got returns -1 (forever).  -1 
returning from a NONBLOCK read is accepted behaviour, but pretty quickly 
the read() should give some data.  Instead it returns -1 each time.  (If 
I allow fd[0] to be in blocking mode, the read() never returns).

Thinking that perhaps the

A mangled stdout came to mind, but this does not appear to be the case.  
But maybe sqlite_open() or other internals diddle with stdout?


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to