1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-14 23:46:14 +00:00

Zero buffers before filling for write. (#177)

We were filling in parts of a buffer and writing it, but that
left some parts either uninitialized or with stale data from
the last read.

This clears out the buffer first so that we're not sending junk.
This commit is contained in:
Bruce Mitchener 2021-01-05 00:43:08 +07:00 committed by GitHub
parent a481057fbe
commit 85aa360f2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -141,6 +141,7 @@ void wait_for_comm_processes(void) {
int slot;
unsigned char d[5];
memset(d, 0, sizeof(d));
d[0] = 'W';
write(UnixPipeOut, d, 4);
SAFEREAD(UnixPipeIn, d, 4);
@ -160,6 +161,7 @@ void wait_for_comm_processes(void) {
}
}
/* Look for another stopped process. */
memset(d, 0, sizeof(d));
d[0] = 'W';
write(UnixPipeOut, d, 4);
SAFEREAD(UnixPipeIn, d, 4);
@ -383,6 +385,7 @@ LispPTR Unix_handlecomm(LispPTR *args) {
if (listen(sockFD, 1) < 0) perror("Listen");
memset(d, 0, sizeof(d));
d[0] = 'F';
d[3] = sockFD;
write(UnixPipeOut, d, 4);
@ -621,6 +624,7 @@ LispPTR Unix_handlecomm(LispPTR *args) {
case 5: /* Kill all the subprocesses */ close_unix_descriptors(); return (ATOM_T);
case 6: /* Kill this subprocess */
memset(d, 0, sizeof(d));
d[0] = 'C';
/* Get job # */