[nightview] Fix build with -Werror=format-security

Lubomir Rintel lkundrak at fedoraproject.org
Wed Dec 4 22:43:10 UTC 2013


commit 53e3f6616df5159bc3e2068a484d08c8821f56cc
Author: Lubomir Rintel <lkundrak at v3.sk>
Date:   Wed Dec 4 23:43:05 2013 +0100

    Fix build with -Werror=format-security

 nightview-0.3.2-initscript.patch |   33 --------------------------------
 nightview-0.3.3-formatsec.patch  |   39 ++++++++++++++++++++++++++++++++++++++
 nightview.spec                   |    8 ++++++-
 3 files changed, 46 insertions(+), 34 deletions(-)
---
diff --git a/nightview-0.3.3-formatsec.patch b/nightview-0.3.3-formatsec.patch
new file mode 100644
index 0000000..030e698
--- /dev/null
+++ b/nightview-0.3.3-formatsec.patch
@@ -0,0 +1,39 @@
+From 0fe8cc878224aa099d92951b77ea4cd993b9d728 Mon Sep 17 00:00:00 2001
+From: Lubomir Rintel <lkundrak at v3.sk>
+Date: Wed, 4 Dec 2013 23:17:16 +0100
+Subject: [PATCH] Fix build with -Werror=format-security
+
+Fedora, starting with version 21, will enable this flag in order to limit
+potentially insecure uses of format strings. It is required for format strings
+to be constant now.
+---
+ shell/night_filter.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/shell/night_filter.c b/shell/night_filter.c
+index 4f91d8d..0cb9a73 100644
+--- a/shell/night_filter.c
++++ b/shell/night_filter.c
+@@ -32,7 +32,7 @@ int main(int argc, char *argv[])
+   CCD *ccd;
+   char *host = NIGHT_LOCALHOST;
+   float t;
+-  char *indicator[] = { "-", "/", "|", "\\" };
++  char indicator[] = { '-', '/', '|', '\\' };
+ 
+   host = getenv(NIGHTVIEW_HOST);
+   if( host == NULL )
+@@ -114,8 +114,8 @@ int main(int argc, char *argv[])
+         for( t = 0.0; filter_status(ccd) == RUN && t < 5.0; t = t + 0.2   ) {
+ 	  if( prs ) {
+ 	    for(i=0; i< l;i++)
+-	      printf("\b");
+-	    l = printf(indicator[i%4]);
++	      putchar('\b');
++	    l = putchar(indicator[i%4]);
+ 	    fflush(stdout);
+ 	  }
+           usleep(200000);
+-- 
+1.8.4.2
+
diff --git a/nightview.spec b/nightview.spec
index 24a74af..ee3f931 100644
--- a/nightview.spec
+++ b/nightview.spec
@@ -1,6 +1,6 @@
 Name:           nightview
 Version:        0.3.3
-Release:        11%{?dist}
+Release:        12%{?dist}
 Summary:        A general astronomical software package to control of a CCD camera
 
 Group:          Amusements/Graphics
@@ -15,6 +15,8 @@ Patch1:         nightview-0.3.3-initscript.patch
 Patch2:         nightview-0.3.1-doc.patch
 Patch3:		nightview-0.3.3-curl.patch
 Patch4:		nightview-0.3.3-unistd.patch
+# Sent by e-mail to Filip Hroch <hroch at physics.muni.cz>
+Patch5:		nightview-0.3.3-formatsec.patch
 
 BuildRequires:  cfitsio-devel
 BuildRequires:  wxGTK-devel
@@ -94,6 +96,7 @@ See description of "nightview" package for more details.
 %patch2 -p1 -b .doc
 %patch3 -p1 -b .curl
 %patch4 -p1 -b .unistd
+%patch5 -p1 -b .formatsec
 
 %build
 # configure.in has a typo, patching it would need regeneration of configure
@@ -238,6 +241,9 @@ fi
 
 
 %changelog
+* Wed Dec 04 2013 Lubomir Rintel <lkundrak at v3.sk> - 0.3.3-12
+- Fix build with -Werror=format-security
+
 * Thu Oct 24 2013 Lubomir Rintel <lkundrak at v3.sk> - 0.3.3-11
 - Bulk sad and useless attempt at consistent SPEC file formatting
 


More information about the scm-commits mailing list