On Aug 11, 2009, at 2:53 PM, Mark Richards wrote: > 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]);
Have you tried called sqlite3_close() here to see if that helps? All of SQLite's file descriptors are FD_CLOEXEC, but who knows.... > 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 D. Richard Hipp d...@hwaci.com _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users