[at] test for write error on fclose (#1166882)
Tomáš Mráz
tmraz at fedoraproject.org
Mon Nov 24 14:36:06 UTC 2014
commit 4fe15d5740188a3ac3f1dafed3a26e2165ececd4
Author: Tomas Mraz <tmraz at fedoraproject.org>
Date: Mon Nov 24 15:35:59 2014 +0100
test for write error on fclose (#1166882)
- also drop unnecessary and broken nowrap patch
at-3.1.14-nowrap.patch | 12 ------------
at-3.1.16-fclose-error.patch | 26 ++++++++++++++++++++++++++
at.spec | 9 ++++++---
3 files changed, 32 insertions(+), 15 deletions(-)
---
diff --git a/at-3.1.16-fclose-error.patch b/at-3.1.16-fclose-error.patch
new file mode 100644
index 0000000..5006d68
--- /dev/null
+++ b/at-3.1.16-fclose-error.patch
@@ -0,0 +1,26 @@
+diff -up at-3.1.16/at.c.fclose at-3.1.16/at.c
+--- at-3.1.16/at.c.fclose 2014-11-06 16:11:28.000000000 +0100
++++ at-3.1.16/at.c 2014-11-24 15:30:12.704502966 +0100
+@@ -209,7 +209,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;
+ }
+
+@@ -494,7 +498,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
+ */
diff --git a/at.spec b/at.spec
index 012ecc6..14f02c4 100644
--- a/at.spec
+++ b/at.spec
@@ -3,7 +3,7 @@
Summary: Job spooling tools
Name: at
Version: 3.1.16
-Release: 3%{?dist}
+Release: 4%{?dist}
# http://packages.debian.org/changelogs/pool/main/a/at/current/copyright
# + install-sh is MIT license with changes under Public Domain
License: GPLv3+ and GPLv2+ and ISC and MIT and Public Domain
@@ -23,13 +23,13 @@ Patch3: at-3.1.14-selinux.patch
Patch4: at-3.1.14-opt_V.patch
Patch5: at-3.1.14-shell.patch
Patch6: at-3.1.14-nitpicks.patch
-Patch7: at-3.1.14-nowrap.patch
Patch8: at-3.1.14-fix_no_export.patch
Patch9: at-3.1.14-mailwithhostname.patch
Patch10: at-3.1.14-usePOSIXtimers.patch
Patch11: at-3.1.14-help.patch
Patch12: at-3.1.14-wrong_format.patch
Patch13: at-3.1.16-noabort.patch
+Patch14: at-3.1.16-fclose-error.patch
BuildRequires: fileutils /etc/init.d
BuildRequires: flex flex-static bison autoconf
@@ -72,13 +72,13 @@ cp %{SOURCE1} .
%patch4 -p1 -b .opt_V
%patch5 -p1 -b .shell
%patch6 -p1 -b .nit
-%patch7 -p1 -b .nowrap
%patch8 -p1 -b .export
%patch9 -p1 -b .mail
%patch10 -p1 -b .posix
%patch11 -p1 -b .help
%patch12 -p1 -b .wrong
%patch13 -p1 -b .noabort
+%patch14 -p1 -b .fclose
%build
# patch9 touches configure.in
@@ -176,6 +176,9 @@ chown daemon:daemon %{_localstatedir}/spool/at/.SEQ
%attr(0644,root,root) /%{_unitdir}/atd.service
%changelog
+* Mon Nov 24 2014 Tomáš Mráz <tmraz at redhat.com> - 3.1.16-4
+- test for write error on fclose (#1166882)
+
* Thu Nov 6 2014 Tomáš Mráz <tmraz at redhat.com> - 3.1.16-3
- make atd less abort prone
More information about the scm-commits
mailing list