On Friday, 14 July 2017 15:39:18 CEST Richard W.M. Jones wrote: > +let part_get_mbr_id device partnum = > + if partnum <= 0 then > + failwith "partition number must be >= 1"; > + > + let param = > + if Lazy.force test_sfdisk_has_part_type then > + "--part-type" > + else > + "--print-id" in > + > + udev_settle (); > + let out = > + command "sfdisk" [param; device; string_of_int partnum] in > + udev_settle (); > + > + (* It's printed in hex, possibly with a leading space. *) > + sscanf out " %x" identity
I see that the C sscanf discards the leading spaces, so maybe it would be safer to use String.triml to behave the same, and not break in case sfdisk changes its output in the future. -- Pino Toscano
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Libguestfs mailing list [email protected] https://www.redhat.com/mailman/listinfo/libguestfs
