4fe15d5
diff -up at-3.1.16/at.c.fclose at-3.1.16/at.c
4fe15d5
--- at-3.1.16/at.c.fclose	2014-11-06 16:11:28.000000000 +0100
4fe15d5
+++ at-3.1.16/at.c	2014-11-24 15:30:12.704502966 +0100
4fe15d5
@@ -209,7 +209,11 @@ nextjob()
4fe15d5
     jobno = (1 + jobno) % 0xfffff;	/* 2^20 jobs enough? */
4fe15d5
     fprintf(fid, "%05lx\n", jobno);
4fe15d5
 
4fe15d5
-    fclose(fid);
4fe15d5
+    if (ferror(fid))
4fe15d5
+	jobno = EOF;
4fe15d5
+
4fe15d5
+    if (fclose(fid) != 0)
4fe15d5
+	jobno = EOF;
4fe15d5
     return jobno;
4fe15d5
 }
4fe15d5
 
4fe15d5
@@ -494,7 +498,8 @@ writefile(time_t runtimer, char queue)
4fe15d5
     if (ferror(stdin))
4fe15d5
 	panic("Input error");
4fe15d5
 
4fe15d5
-    fclose(fp);
4fe15d5
+    if (fclose(fp) != 0)
4fe15d5
+	panic("Output error");
4fe15d5
 
4fe15d5
     /* Set the x bit so that we're ready to start executing
4fe15d5
      */