Skip to contentSkip to conversation

tools: clean up mingw ifdefs

PATCH New Mike Frysinger 2 participants 2 messages Jul 19, 2012 – Jul 20, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools: clean up mingw ifdefs

We have a header file specifically for mingw cruft, so keep it there to avoid crap spreading into the main tools. This lets our devs just worry about *nix systems.

---
 tools/mingw_support.h |    8 ++++++++
 tools/mkenvimage.c    |   10 ++--------
 2 files changed, 10 insertions(+), 8 deletions(-)
tools/mingw_support.h +8 -0
index ee07290..48b8010 100644
@@ -34,6 +34,14 @@
 #define MAP_SHARED	0x01		/* Share changes */
 #define MAP_PRIVATE	0x02		/* Changes are private */
 
+/* File perms */
+#ifndef S_IRGRP
+# define S_IRGRP 0
+#endif
+#ifndef S_IWGRP
+# define S_IWGRP 0
+#endif
+
 /* Windows 64-bit access macros */
 #define LODWORD(x) ((DWORD)((DWORDLONG)(x)))
 #define HIDWORD(x) ((DWORD)(((DWORDLONG)(x) >> 32) & 0xffffffff))
tools/mkenvimage.c +2 -8
index 4001d2f..5521268 100644
@@ -46,13 +46,6 @@
 
 #define CRC_SIZE sizeof(uint32_t)
 
-#ifdef __MINGW32__
-#define FILE_PERM		(S_IRUSR | S_IWUSR)
-#else
-#define FILE_PERM		(S_IRUSR | S_IWUSR | S_IRGRP |\
-					     S_IWGRP)
-#endif
-
 static void usage(const char *exec_name)
 {
 	fprintf(stderr, "%s [-h] [-r] [-b] [-p <byte>] -s <environment partition size> -o <output> <input file>\n"
@@ -300,7 +293,8 @@ int main(int argc, char **argv)
 	if (!bin_filename || strcmp(bin_filename, "-") == 0) {
 		bin_fd = STDOUT_FILENO;
 	} else {
-		bin_fd = creat(bin_filename, FILE_PERM);
+		bin_fd = creat(bin_filename, S_IRUSR | S_IWUSR | S_IRGRP |
+					     S_IWGRP);
 		if (bin_fd == -1) {
 			fprintf(stderr, "Can't open output file \"%s\": %s\n",
 					bin_filename, strerror(errno));
Signature · 1 line
1.7.9.7
#1 lore raw

PATCH 1/1 tools: clean up mingw ifdefs

Dear Mike Frysinger,

Quoted 9 lines · In message <[email protected]> you wrote:

We have a header file specifically for mingw cruft, so keep it there to avoid crap spreading into the main tools. This lets our devs just worry about *nix systems.

---
 tools/mingw_support.h |    8 ++++++++
 tools/mkenvimage.c    |   10 ++--------
 2 files changed, 10 insertions(+), 8 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If a man had a child who'd gone  anti-social,  killed  perhaps,  he'd
still tend to protect that child.
	-- McCoy, "The Ultimate Computer", stardate 4731.3