mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
daemon/utils.ml: Replace Bytes.get_uint8 with native call
Bytes.get_uint8 was added in OCaml 4.08. To support OCaml >= 4.04 (in
particular, RHEL 8 has OCaml 4.07) we have to replace this function
with the equivalent native call. We can remove this commit once the
baseline OCaml moves up.
Updates: commit edfebee404
This commit is contained in:
@@ -187,6 +187,11 @@ and compare_device_names a b =
|
||||
)
|
||||
)
|
||||
|
||||
(* Bytes.get_uint8 was added in OCaml 4.08, so when we depend on
|
||||
* that version, remove this definition.
|
||||
*)
|
||||
external bytes_get_uint8 : bytes -> int -> int = "%bytes_safe_get"
|
||||
|
||||
let has_bogus_mbr device =
|
||||
try
|
||||
with_openfile device [O_RDONLY; O_CLOEXEC] 0 (fun fd ->
|
||||
@@ -201,7 +206,7 @@ let has_bogus_mbr device =
|
||||
0x0E (* FAT16B LBA *)] in
|
||||
let sec0 = Bytes.create sec0size in
|
||||
let sec0read = read fd sec0 0 sec0size in
|
||||
let sec0at = Bytes.get_uint8 sec0 in
|
||||
let sec0at = bytes_get_uint8 sec0 in
|
||||
|
||||
(* sector read completely *)
|
||||
sec0read = sec0size &&
|
||||
|
||||
Reference in New Issue
Block a user