[gpart] Build gpart with RPM_OPT_FLAGS and fix O_CREAT usage in

David Cantrell dcantrel at fedoraproject.org
Wed Aug 14 17:41:33 UTC 2013


commit 3e5f6d2554823f305ea1cc8a0bbd9c7e51ed6012
Author: David Cantrell <david.l.cantrell at gmail.com>
Date:   Wed Aug 14 13:41:00 2013 -0400

    Build gpart with RPM_OPT_FLAGS and fix O_CREAT usage in
    
      make_mbr_backup() function in gpart.c (#977147)

 gpart-0.1h-O_CREAT.patch   |   12 ++++++++++++
 gpart-0.1h-cflags.patch    |    8 ++++----
 gpart-0.1h-largefile.patch |    9 +++++----
 gpart.spec                 |    8 +++++++-
 4 files changed, 28 insertions(+), 9 deletions(-)
---
diff --git a/gpart-0.1h-O_CREAT.patch b/gpart-0.1h-O_CREAT.patch
new file mode 100644
index 0000000..44d303d
--- /dev/null
+++ b/gpart-0.1h-O_CREAT.patch
@@ -0,0 +1,12 @@
+diff -up gpart-0.1h/src/gpart.c.O_CREAT gpart-0.1h/src/gpart.c
+--- gpart-0.1h/src/gpart.c.O_CREAT	2013-08-14 13:38:11.183584599 -0400
++++ gpart-0.1h/src/gpart.c	2013-08-14 13:38:58.445584599 -0400
+@@ -1221,7 +1221,7 @@ static int make_mbr_backup(disk_desc *d,
+ {
+ 	int		fd, ret = 0;
+ 
+-	if ((fd = open(bfile,O_WRONLY|O_CREAT)) < 0)
++	if ((fd = open(bfile,S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH,O_WRONLY|O_CREAT)) < 0)
+ 		return (ret);
+ 
+ 	if (write(fd,d->d_pt.t_boot,512) == 512)
diff --git a/gpart-0.1h-cflags.patch b/gpart-0.1h-cflags.patch
index 58fb0ee..dd9d0e2 100644
--- a/gpart-0.1h-cflags.patch
+++ b/gpart-0.1h-cflags.patch
@@ -1,12 +1,12 @@
-diff -ru gpart-0.1h.orig/make.defs gpart-0.1h/make.defs
---- gpart-0.1h.orig/make.defs	2001-01-29 14:17:12.000000000 -0500
-+++ gpart-0.1h/make.defs	2005-06-08 11:11:48.000000000 -0400
+diff -up gpart-0.1h/make.defs.cflags gpart-0.1h/make.defs
+--- gpart-0.1h/make.defs.cflags	2001-01-29 14:17:12.000000000 -0500
++++ gpart-0.1h/make.defs	2013-08-14 13:27:08.516584599 -0400
 @@ -2,7 +2,7 @@
  #
  #
  CC      = gcc
 -CFLAGS  = -Wall -O2 -pedantic
-+CFLAGS  = -Wall -O2
++CFLAGS  = -Wall -O2 $(RPM_OPT_FLAGS)
  LDFLAGS =
  MAKEDEP = gcc -M
  INSTALL = install
diff --git a/gpart-0.1h-largefile.patch b/gpart-0.1h-largefile.patch
index 117fa4d..66c2ead 100644
--- a/gpart-0.1h-largefile.patch
+++ b/gpart-0.1h-largefile.patch
@@ -1,11 +1,12 @@
---- gpart-0.1h/make.defs.largefile	2006-10-22 14:49:44.000000000 -0400
-+++ gpart-0.1h/make.defs	2006-10-22 14:51:12.000000000 -0400
+diff -up gpart-0.1h/make.defs.largefile gpart-0.1h/make.defs
+--- gpart-0.1h/make.defs.largefile	2013-08-14 13:27:08.516584599 -0400
++++ gpart-0.1h/make.defs	2013-08-14 13:28:12.084584599 -0400
 @@ -2,7 +2,7 @@
  #
  #
  CC      = gcc
--CFLAGS  = -Wall -O2
-+CFLAGS  = -Wall -O2 -D_FILE_OFFSET_BITS=64
+-CFLAGS  = -Wall -O2 $(RPM_OPT_FLAGS)
++CFLAGS  = -Wall -O2 $(RPM_OPT_FLAGS) -D_FILE_OFFSET_BITS=64
  LDFLAGS =
  MAKEDEP = gcc -M
  INSTALL = install
diff --git a/gpart.spec b/gpart.spec
index f774876..34f3498 100644
--- a/gpart.spec
+++ b/gpart.spec
@@ -1,7 +1,7 @@
 Summary: A program for recovering corrupt partition tables
 Name:    gpart
 Version: 0.1h
-Release: 19%{?dist}
+Release: 20%{?dist}
 License: GPLv2+
 Group:   Applications/System
 URL:     http://www.stud.uni-hannover.de/user/76201/gpart/
@@ -14,6 +14,7 @@ Patch3: %{name}-0.1h-syscall.patch
 Patch4: %{name}-0.1h-largefile.patch
 Patch5: %{name}-0.1h-makefile.patch
 Patch6: %{name}-0.1h-x86_64.patch
+Patch7: %{name}-0.1h-O_CREAT.patch
 
 Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: glibc-kernheaders
@@ -33,6 +34,7 @@ type harddisk in case the primary partition table was damaged.
 %patch4 -p1 -b .largefile
 %patch5 -p1 -b .makefile
 %patch6 -p1 -b .x86_64
+%patch7 -p1 -b .O_CREAT
 
 %build
 make %{?_smp_mflags}
@@ -54,6 +56,10 @@ rm -rf %{buildroot}
 %{_mandir}/man8/%{name}.8*
 
 %changelog
+* Wed Aug 14 2013 David Cantrell <dcantrell at redhat.com> - 0.1h-20
+- Build gpart with RPM_OPT_FLAGS and fix O_CREAT usage in
+  make_mbr_backup() function in gpart.c (#977147)
+
 * Sat Aug 03 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.1h-19
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
 


More information about the scm-commits mailing list