Fixing a bug in the server, that made the server crash if the output file was queuelimit2
authorviric <viriketo@gmail.com>
Mon, 18 Jul 2011 22:43:05 +0200
branchqueuelimit2
changeset 289 f331d05328b3
parent 288 8459747e1a73
child 290 eefb37e0a8fe
Fixing a bug in the server, that made the server crash if the output file was asked on a job without output, like those resulting of ctrl-c while the client enqueuing was blocking.
jobs.c
--- a/jobs.c	Mon Jul 18 22:38:02 2011 +0200
+++ b/jobs.c	Mon Jul 18 22:43:05 2011 +0200
@@ -880,12 +880,13 @@
     m.type = ANSWER_OUTPUT;
     m.u.output.store_output = p->store_output;
     m.u.output.pid = p->pid;
-    if (m.u.output.store_output)
+    if (m.u.output.store_output && p->output_filename)
         m.u.output.ofilename_size = strlen(p->output_filename) + 1;
     else
         m.u.output.ofilename_size = 0;
     send_msg(s, &m);
-    send_bytes(s, p->output_filename, m.u.output.ofilename_size);
+    if (m.u.output.ofilename_size > 0)
+        send_bytes(s, p->output_filename, m.u.output.ofilename_size);
 }
 
 void notify_errorlevel(struct Job *p)