Commit d1922b48 by Alexandre Oliva Committed by Alexandre Oliva

server.c (load_data): Return NULL if the marker line is not found.

* fixinc/server.c (load_data): Return NULL if the marker line is
not found.
(run_shell): If load_data returns NULL, retry the command once, in
a new shell.

From-SVN: r31894
parent 139cfaa7
2000-02-10 Alexandre Oliva <oliva@lsd.ic.unicamp.br> 2000-02-10 Alexandre Oliva <oliva@lsd.ic.unicamp.br>
* fixinc/server.c (load_data): Return NULL if the marker line is
not found.
(run_shell): If load_data returns NULL, retry the command once, in
a new shell.
* configure: Rebuilt. * configure: Rebuilt.
2000-02-09 Bruce Korb <bkorb@gnu.org> 2000-02-09 Bruce Korb <bkorb@gnu.org>
......
...@@ -114,6 +114,7 @@ load_data (fp) ...@@ -114,6 +114,7 @@ load_data (fp)
size_t text_size; size_t text_size;
char *pz_scan; char *pz_scan;
char z_line[1024]; char z_line[1024];
t_bool got_done = BOOL_FALSE;
text_size = sizeof (z_line) * 2; text_size = sizeof (z_line) * 2;
pz_scan = pz_text = malloc (text_size); pz_scan = pz_text = malloc (text_size);
...@@ -131,7 +132,10 @@ load_data (fp) ...@@ -131,7 +132,10 @@ load_data (fp)
break; break;
if (strncmp (z_line, z_done, sizeof (z_done) - 1) == 0) if (strncmp (z_line, z_done, sizeof (z_done) - 1) == 0)
{
got_done = BOOL_TRUE;
break; break;
}
strcpy (pz_scan, z_line); strcpy (pz_scan, z_line);
pz_scan += strlen (z_line); pz_scan += strlen (z_line);
...@@ -157,7 +161,7 @@ load_data (fp) ...@@ -157,7 +161,7 @@ load_data (fp)
} }
alarm (0); alarm (0);
if (read_pipe_timeout) if (read_pipe_timeout || ! got_done)
{ {
free ((void *) pz_text); free ((void *) pz_text);
return (char *) NULL; return (char *) NULL;
...@@ -255,6 +259,9 @@ char * ...@@ -255,6 +259,9 @@ char *
run_shell (pz_cmd) run_shell (pz_cmd)
const char *pz_cmd; const char *pz_cmd;
{ {
t_bool retry = BOOL_TRUE;
do_retry:
/* IF the shell server process is not running yet, /* IF the shell server process is not running yet,
THEN try to start it. */ THEN try to start it. */
if (server_id == NULLPROCESS) if (server_id == NULLPROCESS)
...@@ -299,9 +306,16 @@ run_shell (pz_cmd) ...@@ -299,9 +306,16 @@ run_shell (pz_cmd)
if (pz == (char *) NULL) if (pz == (char *) NULL)
{ {
close_server ();
if (retry)
{
retry = BOOL_FALSE;
goto do_retry;
}
fprintf (stderr, "CLOSING SHELL SERVER - command failure:\n\t%s\n", fprintf (stderr, "CLOSING SHELL SERVER - command failure:\n\t%s\n",
pz_cmd); pz_cmd);
close_server ();
pz = (char *) malloc (1); pz = (char *) malloc (1);
if (pz != (char *) NULL) if (pz != (char *) NULL)
*pz = '\0'; *pz = '\0';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment