Suggested patch: reset errno after isatty()

Ketil Froyn ketil at froyn.name
Wed Nov 24 09:30:39 EST 2010


On Wed, Nov 24, 2010 at 3:12 PM, Artem Bityutskiy <dedekind1 at gmail.com> wrote:
>
> So it dies very soon. You should easily find the line of code where this
> happens with gdb. Just compile nanddump with -g -O0

It's just that I have limited tools on my device where this happens.
But I've finally pinned it!

There's a couple of issues, I guess. Firstly, calling mtd_read_oob()
with an oob_size of 0 segfaults, which I guess it shouldn't. I haven't
looked into that. The problem here was that the oob_size was set to 0,
and that happens because the legacy code forgot to set it. This patch
fixes it for me:

diff --git a/lib/libmtd_legacy.c b/lib/libmtd_legacy.c
index 7488275..d6c3938 100644
--- a/lib/libmtd_legacy.c
+++ b/lib/libmtd_legacy.c
@@ -261,6 +261,7 @@ int legacy_get_dev_info(const char *node, struct
mtd_dev_info *mtd)
        mtd->size = ui.size;
        mtd->eb_size = ui.erasesize;
        mtd->min_io_size = ui.writesize;
+       mtd->oob_size = ui.oobsize;

        if (mtd->min_io_size <= 0) {
                errmsg("mtd%d (%s) has insane min. I/O unit size %d",


Cheers, Ketil



More information about the linux-mtd mailing list