]> git.ipfire.org Git - thirdparty/u-boot.git/blobdiff - tools/mkenvimage.c
tools: Fix mingw tools build
[thirdparty/u-boot.git] / tools / mkenvimage.c
index 55212687e17d0162790002c1c3e5fffbfccb45ca..4001d2f517d78040653a2c51c5194e70552fc123 100644 (file)
 
 #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));