summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/genext2fs/genext2fs-1.4.1/0001-Fix-warnings-remove-some-unused-macros.patch
blob: f981b449ba93ed2c6cbe52f9fae2db8ac60794b0 (plain)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
Upstream-Status: inappropriate

From 1399df7672ec309523bcd067da24d72aa624f783 Mon Sep 17 00:00:00 2001
From: Corey Minyard <cminyard@mvista.com>
Date: Wed, 1 Jun 2011 07:51:24 -0500
Subject: [PATCH 01/19] Fix warnings, remove some unused macros.

These are some annoying warnings with newer toolchains.  And NAMLEN is
never used, so just get rid of it.
---
 genext2fs.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/genext2fs.c b/genext2fs.c
index f0d797d..284862d 100644
--- a/genext2fs.c
+++ b/genext2fs.c
@@ -107,10 +107,8 @@
 
 #if HAVE_DIRENT_H
 # include <dirent.h>
-# define NAMLEN(dirent) strlen((dirent)->d_name)
 #else
 # define dirent direct
-# define NAMLEN(dirent) (dirent)->d_namlen
 # if HAVE_SYS_NDIR_H
 #  include <sys/ndir.h>
 # endif
@@ -1441,7 +1439,8 @@ mkfile_fs(filesystem *fs, uint32 parent_nod, const char *name, uint32 mode, size
 		if(!(b = (uint8*)calloc(rndup(size, BLOCKSIZE), 1)))
 			error_msg_and_die("not enough mem to read file '%s'", name);
 		if(f)
-			fread(b, size, 1, f); // FIXME: ugly. use mmap() ...
+			if (fread(b, size, 1, f) != 1) // FIXME: ugly. use mmap() ...
+				error_msg_and_die("fread failed");
 		extend_blk(fs, nod, b, rndup(size, BLOCKSIZE) / BLOCKSIZE);
 		free(b);
 	}
@@ -1673,7 +1672,9 @@ add2fs_from_dir(filesystem *fs, uint32 this_nod, int squash_uids, int squash_per
 					if(chdir(dent->d_name) < 0)
 						perror_msg_and_die(dent->d_name);
 					add2fs_from_dir(fs, this_nod, squash_uids, squash_perms, fs_timestamp, stats);
-					chdir("..");
+					if (chdir("..") == -1)
+						perror_msg_and_die("..");
+
 					break;
 				default:
 					break;
@@ -1687,7 +1688,8 @@ add2fs_from_dir(filesystem *fs, uint32 this_nod, int squash_uids, int squash_per
 					if(chdir(dent->d_name) < 0)
 						perror_msg_and_die(name);
 					add2fs_from_dir(fs, nod, squash_uids, squash_perms, fs_timestamp, stats);
-					chdir("..");
+					if (chdir("..") == -1)
+						perror_msg_and_die("..");
 				}
 				continue;
 			}
@@ -1733,7 +1735,8 @@ add2fs_from_dir(filesystem *fs, uint32 this_nod, int squash_uids, int squash_per
 					if(chdir(dent->d_name) < 0)
 						perror_msg_and_die(name);
 					add2fs_from_dir(fs, nod, squash_uids, squash_perms, fs_timestamp, stats);
-					chdir("..");
+					if (chdir("..") == -1)
+						perror_msg_and_die("..");
 					break;
 				default:
 					error_msg("ignoring entry %s", name);
-- 
1.7.4.1