[gpart/f19] Build gpart with RPM_OPT_FLAGS and fix O_CREAT usage in make_mbr_backup()

David Cantrell dcantrel at fedoraproject.org
Wed Aug 14 17:51:55 UTC 2013


commit 064bcd4551162dbcc89af2e9857ffaab03e7943c
Author: David Cantrell <dcantrell at redhat.com>
Date:   Wed Aug 14 13:51:38 2013 -0400

    Build gpart with RPM_OPT_FLAGS and fix O_CREAT usage in make_mbr_backup()
    
      function in gpart.c (#977147)
    - Add x86_64 to the ExclusiveArch listing
    - Patch gm_ntfs.h so it works on x86_64

 gpart-0.1h-O_CREAT.patch   |   12 ++++++++++++
 gpart-0.1h-cflags.patch    |    8 ++++----
 gpart-0.1h-largefile.patch |    9 +++++----
 gpart-0.1h-x86_64.patch    |   21 +++++++++++++++++++++
 gpart.spec                 |   16 +++++++++++++---
 5 files changed, 55 insertions(+), 11 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-0.1h-x86_64.patch b/gpart-0.1h-x86_64.patch
new file mode 100644
index 0000000..7f27daa
--- /dev/null
+++ b/gpart-0.1h-x86_64.patch
@@ -0,0 +1,21 @@
+diff -up gpart-0.1h/src/gm_ntfs.h.x86_64 gpart-0.1h/src/gm_ntfs.h
+--- gpart-0.1h/src/gm_ntfs.h.x86_64	2001-01-29 10:33:58.000000000 -1000
++++ gpart-0.1h/src/gm_ntfs.h	2010-11-02 05:32:26.000000000 -1000
+@@ -29,7 +29,7 @@
+ /* 'NTFS' in little endian */
+ #define NTFS_SUPER_MAGIC	0x5346544E
+ 
+-#if defined(i386) || defined(__i386__) || defined(__alpha__)
++#if defined(i386) || defined(__i386__) || defined(__alpha__) || defined(__x86_64__)
+ 
+ /* unsigned integral types */
+ #ifndef NTFS_INTEGRAL_TYPES
+@@ -39,7 +39,7 @@ typedef unsigned short		ntfs_u16;
+ typedef unsigned int		ntfs_u32;
+ typedef s64_t			ntfs_u64;
+ #endif /* NTFS_INTEGRAL_TYPES */
+-#endif /* defined(i386) || defined(__i386__) || defined(__alpha__) */
++#endif /* defined(i386) || defined(__i386__) || defined(__alpha__) || defined(__x86_64__) */
+ 
+ 
+ /* Macros reading unsigned integers from a byte pointer */
diff --git a/gpart.spec b/gpart.spec
index 56b7a94..19303e2 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: 17%{?dist}
+Release: 18%{?dist}
 License: GPLv2+
 Group:   Applications/System
 URL:     http://www.stud.uni-hannover.de/user/76201/gpart/
@@ -13,11 +13,13 @@ Patch2: %{name}-0.1h-errno.patch
 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
 
-ExclusiveArch: %{ix86}
+ExclusiveArch: %{ix86} x86_64
 
 %description
 Gpart is a small tool which tries to guess what partitions are on a PC
@@ -31,6 +33,8 @@ type harddisk in case the primary partition table was damaged.
 %patch3 -p1 -b .syscall
 %patch4 -p1 -b .largefile
 %patch5 -p1 -b .makefile
+%patch6 -p1 -b .x86_64
+%patch7 -p1 -b .O_CREAT
 
 %build
 make %{?_smp_mflags}
@@ -52,6 +56,12 @@ rm -rf %{buildroot}
 %{_mandir}/man8/%{name}.8*
 
 %changelog
+* Wed Aug 14 2013 David Cantrell <dcantrell at redhat.com> - 0.1h-18
+- Build gpart with RPM_OPT_FLAGS and fix O_CREAT usage in make_mbr_backup()
+  function in gpart.c (#977147)
+- Add x86_64 to the ExclusiveArch listing
+- Patch gm_ntfs.h so it works on x86_64
+
 * Thu Feb 14 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.1h-17
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
 
@@ -109,5 +119,5 @@ rm -rf %{buildroot}
 * Fri Dec 09 2005 Jesse Keating <jkeating at redhat.com>
 - rebuilt
 
-* Wed Jun 10 2005 Chris Lumens <clumens at redhat.com> 0.1h-1
+* Fri Jun 10 2005 Chris Lumens <clumens at redhat.com> 0.1h-1
 - Initial build.


More information about the scm-commits mailing list