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