1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
Subject: [PATCH] Silence compiler warning and possible build break
From: Carsten Schlote <c.schlote@konzeptpark.de>
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 <c.schlote@konzeptpark.de>
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;
}
|