summaryrefslogtreecommitdiff
path: root/tools/mkenvimage.c
diff options
context:
space:
mode:
authorVladimir Yakovlev <nagos@inbox.ru>2012-07-07 10:05:06 +0000
committerWolfgang Denk <wd@denx.de>2012-07-08 22:41:19 +0200
commit8b6a4952e6064dc558cb7d5d375990b17491f26f (patch)
tree97457abdb9280332b27841ad34eec716532d3f9e /tools/mkenvimage.c
parentdb7720bad4ae0577c140fd72def24311afece894 (diff)
tools: Fix mingw tools build
mkenvimage does not build due to missed os_support.o and unsupported file modes S_IRGRP S_IWGRP. Tested with mingw 4.2.1 on ubuntu 12.04. Signed-off-by: Vladimir Yakovlev <nagos@inbox.ru>
Diffstat (limited to 'tools/mkenvimage.c')
-rw-r--r--tools/mkenvimage.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/mkenvimage.c b/tools/mkenvimage.c
index 55212687e1..4001d2f517 100644
--- a/tools/mkenvimage.c
+++ b/tools/mkenvimage.c
@@ -46,6 +46,13 @@
#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"
@@ -293,8 +300,7 @@ int main(int argc, char **argv)
if (!bin_filename || strcmp(bin_filename, "-") == 0) {
bin_fd = STDOUT_FILENO;
} else {
- bin_fd = creat(bin_filename, S_IRUSR | S_IWUSR | S_IRGRP |
- S_IWGRP);
+ bin_fd = creat(bin_filename, FILE_PERM);
if (bin_fd == -1) {
fprintf(stderr, "Can't open output file \"%s\": %s\n",
bin_filename, strerror(errno));