reid@glacier.ARPA (Brian Reid) (01/02/86)
Last week I posted mention of a rare but serious bug in inews that was
tickled when the system ran out of processes. I said the fix was trivial.
Several people asked for copies of the fix. Here is the way I fixed it. I'm
sure that there are better ways, but this works. There's no point adding the
customary code to wait for a fork, because the only reason it's forking is
to make it so the user doesn't have to wait.
*** ../../news2.10.2/src/inews.c Fri Nov 15 11:43:08 1985
--- inews.c Wed Dec 25 21:54:38 1985
***************
*** 374,380
/* Go into the background so the user can get on with his business. */
if (mode != PROC) {
i = fork();
! if (i != 0)
exit(0);
}
#endif VMS
--- 374,380 -----
/* Go into the background so the user can get on with his business. */
if (mode != PROC) {
i = fork();
! if (i > 0)
exit(0);
if (i < 0) {
perror("inews: fork failed for background");
***************
*** 376,381
i = fork();
if (i != 0)
exit(0);
}
#endif VMS
--- 376,385 -----
i = fork();
if (i > 0)
exit(0);
+ if (i < 0) {
+ perror("inews: fork failed for background");
+ log("inews: fork failed for background--continuing", 0);
+ }
}
#endif VMS
/* Do the actual insertion. */
***************
*** 378,384
exit(0);
}
#endif VMS
-
/* Do the actual insertion. */
insert();
}
--- 382,387 -----
}
}
#endif VMS
/* Do the actual insertion. */
insert();
}
--
Brian Reid decwrl!glacier!reid
Stanford reid@SU-Glacier.ARPA