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