diff -up at-3.1.13/at.c.fclose at-3.1.13/at.c
--- at-3.1.13/at.c.fclose 2016-04-20 17:15:00.584327893 +0200
+++ at-3.1.13/at.c 2016-04-20 17:15:50.453609665 +0200
@@ -209,7 +209,11 @@ nextjob()
jobno = (1 + jobno) % 0xfffff; /* 2^20 jobs enough? */
fprintf(fid, "%05lx\n", jobno);
- fclose(fid);
+ if (ferror(fid))
+ jobno = EOF;
+
+ if (fclose(fid) != 0)
+ jobno = EOF;
return jobno;
}
@@ -498,7 +502,8 @@ writefile(time_t runtimer, char queue)
if (ferror(stdin))
panic("Input error");
- fclose(fp);
+ if (fclose(fp) != 0)
+ panic("Output error");
/* Set the x bit so that we're ready to start executing
*/