diff --git a/powertop-2.2-fix-crash-on-readonly-fs.patch b/powertop-2.2-fix-crash-on-readonly-fs.patch new file mode 100644 index 0000000..0147edc --- /dev/null +++ b/powertop-2.2-fix-crash-on-readonly-fs.patch @@ -0,0 +1,41 @@ +From bd72b4433fec358801afebf3f02ab899b1745c5f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jaroslav=20=C5=A0karvada?= +Date: Wed, 28 Nov 2012 16:31:38 +0100 +Subject: [PATCH] report: fixed crash when writing report to RO filesystem +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Jaroslav Škarvada +--- + src/report/report.cpp | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +diff --git a/src/report/report.cpp b/src/report/report.cpp +index 51bc6a7..c018bb1 100644 +--- a/src/report/report.cpp ++++ b/src/report/report.cpp +@@ -183,13 +183,16 @@ void init_report_output(char *filename_str, int iterations) + + void finish_report_output(void) + { +- fprintf(stderr, _("PowerTOP outputing using base filename %s\n"), reportout.filename); + if (reporttype == REPORT_OFF) + return; + + report.finish_report(); +- fputs(report.get_result(), reportout.report_file); +- fdatasync(fileno(reportout.report_file)); +- fclose(reportout.report_file); ++ if (reportout.report_file) ++ { ++ fprintf(stderr, _("PowerTOP outputing using base filename %s\n"), reportout.filename); ++ fputs(report.get_result(), reportout.report_file); ++ fdatasync(fileno(reportout.report_file)); ++ fclose(reportout.report_file); ++ } + report.clear_result(); + } +-- +1.7.11.7 + diff --git a/powertop.spec b/powertop.spec index 15c3734..d65814f 100644 --- a/powertop.spec +++ b/powertop.spec @@ -1,6 +1,6 @@ Name: powertop Version: 2.2 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Power consumption monitor Group: Applications/System @@ -10,6 +10,8 @@ Source0: http://01.org/powertop/sites/default/files/downloads/%{name}-%{ve # Sent upstream Patch0: powertop-2.0-always-create-params.patch +# Sent upstream +Patch1: powertop-2.2-fix-crash-on-readonly-fs.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: gettext, ncurses-devel, pciutils-devel, zlib-devel, libnl3-devel @@ -20,6 +22,7 @@ computer use more power than necessary while it is idle. %prep %setup -q %patch0 -p1 -b .always-create-params +%patch1 -p1 -b .fix-crash-on-readonly-fs # remove left over object files find . -name "*.o" -exec rm {} \; @@ -52,6 +55,10 @@ rm -rf %{buildroot} %{_mandir}/man8/powertop.8* %changelog +* Wed Nov 28 2012 Jaroslav Škarvada - 2.2-2 +- Fixed crash when writing report on readonly filesystem + (fix-crash-on-readonly-fs patch) + * Fri Nov 23 2012 Jaroslav Škarvada - 2.2-1 - New version Resolves: rhbz#877373