aboutsummaryrefslogtreecommitdiffstats
path: root/community/at/0010-fclose-error.patch
blob: e8f4f573f28fa9a4c77800611b9bd5f14946999f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Patch-Source: https://src.fedoraproject.org/rpms/at/blob/f36/f/at-3.1.16-fclose-error.patch (updated)
--
From 4fe15d5740188a3ac3f1dafed3a26e2165ececd4 Mon Sep 17 00:00:00 2001
From: Tomas Mraz <tmraz@fedoraproject.org>
Date: Nov 24 2014 14:35:59 +0000
Subject: test for write error on fclose (#1166882)

https://bugzilla.redhat.com/show_bug.cgi?id=1166882

diff --git a/at.c b/at.c
--- a/at.c
+++ b/at.c
@@ -228,7 +228,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;
 }
 
@@ -532,7 +536,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
      */