On Tuesday 28 May 2013 17:35:29 Paul B. Henson wrote:
> + if (sscanf(ubi_ctrl, "/dev/ubi%u", &ubinum) != 1)
> + bb_error_msg_and_die("%s device node not in
> correct
format", "UBI");
seems like all of these sscanf would be better off using the existing xstrtou()
helpers ?
> + sprintf(buf, "/sys/class/ubi/ubi%d/avail_eraseblocks",
> ubinum);
you sprintf the same string at the start of buf every time. this would
probably be smaller code:
char buf[100];
char path[...existing sizeof() logic...];
char *p;
p = path + sprintf(path, "/sys/class/ubi/ubi%d/", ubinum);
strcpy(p, "avail_eraseblocks");
if (open_read_close(path, buf, sizeof(buf)) <= 0)
bb_error_msg_and_die(...);
-mike
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
