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