Fixed some warnings, which are handled as error by gcc. Can't hurt to
fix the code.

Signed-off-by: Carsten Schlote <[email protected]>
-- 
Carsten Schlote <[email protected]>
konzeptpark.de
From b358a6d28ec003bb9a35040aa7e3e2c6714304ed Mon Sep 17 00:00:00 2001
From: Carsten Schlote <[email protected]>
Date: Mon, 5 Jan 2009 16:34:51 +0100
Subject: [PATCH] [genpart-1.0.1] Fix compiler warnings

Fix some warnings, which are handled as error by gcc. Can't hurt to
fix the code.

Signed-off-by: Carsten Schlote <[email protected]>
---
 .../generic/fix-compiler-warning.patch             |   37 ++++++++++++++++++++
 patches/genpart-1.0.1/generic/series               |    1 +
 2 files changed, 38 insertions(+), 0 deletions(-)
 create mode 100644 patches/genpart-1.0.1/generic/fix-compiler-warning.patch
 create mode 100644 patches/genpart-1.0.1/generic/series

diff --git a/patches/genpart-1.0.1/generic/fix-compiler-warning.patch b/patches/genpart-1.0.1/generic/fix-compiler-warning.patch
new file mode 100644
index 0000000..973862b
--- /dev/null
+++ b/patches/genpart-1.0.1/generic/fix-compiler-warning.patch
@@ -0,0 +1,37 @@
+[PATCH] Silence compiler warning and possible build break
+
+Changed code to compile without warnings. Broke my build with
+-Werror set as default option by GCC (Ubuntu 8.10)
+
+Signed-off-by: Carsten Schlote <[email protected]>
+
+Index: genpart-1.0.1/src/genpart.c
+===================================================================
+--- genpart-1.0.1.orig/src/genpart.c	2006-12-07 12:54:07.000000000 +0100
++++ genpart-1.0.1/src/genpart.c	2008-11-06 16:59:48.000000000 +0100
+@@ -40,6 +40,7 @@
+ 	struct partition_entry entry;
+ 	int opt, do_magic = 0;
+ 	unsigned short magic = 0xaa55;
++	int rc = 10;
+ 
+ 	struct option long_options[] = {
+ 		{ "help", no_argument, 0, 'h' },
+@@ -87,10 +88,11 @@
+ 		}
+ 	}
+ 
+-	fwrite(&entry, sizeof(struct partition_entry), 1, stdout);
+-
+-	if(do_magic)
+-		fwrite(&magic, 2, 1, stdout);
+-
+-	return 0;
++	if(fwrite(&entry, sizeof(struct partition_entry), 1, stdout)>0) {
++		if(do_magic) {
++			if(fwrite(&magic, 2, 1, stdout)>0)
++				rc=0;
++		}
++	}
++	return rc;
+ }
diff --git a/patches/genpart-1.0.1/generic/series b/patches/genpart-1.0.1/generic/series
new file mode 100644
index 0000000..d24b275
--- /dev/null
+++ b/patches/genpart-1.0.1/generic/series
@@ -0,0 +1 @@
+fix-compiler-warning.patch
-- 
1.5.6.3

--
ptxdist mailing list
[email protected]

Reply via email to