The nand-part.c code tries to re-read the partition tables
by issuing an ioctl(fd, BLKRRPART, NULL). This isn't available
on non-Linux platforms, e.g. Mac OS X.

Add preprocessor conditionals to prevent this from breaking
the build.

Signed-off-by: Bernhard Nortmann <bernhard.nortm...@web.de>
---
 nand-part.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/nand-part.c b/nand-part.c
index e1640dc..a0d46c5 100644
--- a/nand-part.c
+++ b/nand-part.c
@@ -50,8 +50,10 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <string.h>
-#include <sys/ioctl.h>
-#include <sys/mount.h> /* BLKRRPART */
+#ifdef __linux__
+# include <sys/ioctl.h>
+# include <sys/mount.h> /* BLKRRPART */
+#endif
 #include "nand-common.h"
 
 // so far, only known formats are for A10 and A20
@@ -249,8 +251,10 @@ static int writembrs(int fd, char names[][MAX_NAME], __u32 
start, __u32 *lens, u
                write(fd,mbr,MBR_SIZE);
        }
 
+#ifdef __linux__
        if (ioctl(fd, BLKRRPART, NULL))
                perror("Failed rereading partition table");
+#endif
 
        return 1;
 }
@@ -312,7 +316,9 @@ int nand_part (int argc, char **argv, const char *cmd, int 
fd, int force)
                if (writembrs(fd, names, start, lens, user_types, argc, 
partoffset, force)) {
                        printf("\nverifying new partition tables:\n");
                        checkmbrs(fd);
+#ifdef __linux__
                        printf("rereading partition table... returned %d\n", 
ioctl(fd, BLKRRPART, 0));
+#endif
                }
        }
        close(fd);
-- 
2.4.10

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to