wescott@ncrcae.UUCP (12/08/83)
Until about Nov 14, 1983 our uuclean seemed to work fine (we're running UNIX System 5.0 uucp) and then it suddenly started core dumping. The problem is in kill() in rkill.c. The fix is to clean up the code. Evidently the released code had been hacked up to change the method of updating the job status file. It appears that the prior design used two file pointers whereas the release version uses one and a half. The file pointer fq if fclose'd, and fwrite'd but never fopen'd. Since it is an automatic variable, fclose was called with whatever junk was on the stack, which for some reason changed in mid-November. (It probably was a NULL before). ======= diff rkill.c.old rkill.c ======= 43c43 < FILE *fp, *fq; --- > FILE *fp; 66d65 < fclose(fq); 77d75 < fclose(fq); 93d90 < fclose(fq); 102,110c99,112 < if ((uu.jobn==jn) && ((strcmp(uu.user,User)==SAME) < || (getuid()==0))) { < if((uu.ustat&(USR_KINC|USR_KCOMP)) == 0){ < DEBUG(5, "Job %d is deleted\n", jn); < if((uu.ustat&USR_COMP) == 0){ < val = delete(jn); < if(val == USR_QUEUED){ < val = USR_KINC; < fprintf(stderr,"Job %hd not found\n",uu.jobn); --- > if ((uu.jobn==jn) && ((strcmp(uu.user,User)==SAME) || (getuid()==0))) { > if((uu.ustat&(USR_KINC|USR_KCOMP)) == 0){ > DEBUG(5, "Job %d is deleted\n", jn); > if((uu.ustat&USR_COMP) == 0){ > val = delete(jn); > if(val == USR_QUEUED){ > val = USR_KINC; > fprintf(stderr,"Job %hd not found\n",uu.jobn); > } > fnd++; > uu.ustat = val; > fseek(fp,(long)(-sizeof(uu)), 1); > }else{ > fprintf(stderr,"job %hd already complete\n",uu.jobn); 112,116d113 < fnd++; < uu.ustat = val; < fseek(fq,(long)(-sizeof(uu)), 1); < }else{ < fprintf(stderr,"job %hd already complete\n",uu.jobn); 118d114 < } 120c116 < fwrite(&uu, sizeof(uu), 1, fq); --- > fwrite(&uu, sizeof(uu), 1, fp); 128c124 < fclose(fq); --- > fclose(fp); ============= Michael Wescott NCR Corp., West Columbia SC ..duke!mcnc!ncsu!ncrcae!wescott