git.annexia.org
/
whenjobs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d982523
)
32 bit: Fix for 31 bit int overflow in time_t.
author
Richard W.M. Jones
<rjones@redhat.com>
Sat, 28 Apr 2012 19:40:39 +0000
(20:40 +0100)
committer
Richard W.M. Jones
<rjones@redhat.com>
Sat, 28 Apr 2012 19:40:39 +0000
(20:40 +0100)
daemon/daemon.ml
patch
|
blob
|
history
diff --git
a/daemon/daemon.ml
b/daemon/daemon.ml
index
64d4012
..
bbaab13
100644
(file)
--- a/
daemon/daemon.ml
+++ b/
daemon/daemon.ml
@@
-309,7
+309,9
@@
and reload_files () =
else (
let len = String.length file in
let t = String.sub file 6 (len-slen-6) in
else (
let len = String.length file in
let t = String.sub file 6 (len-slen-6) in
- try Some (int_of_string t) with Failure "int_of_string" -> None
+ (* Use int64 because t won't necessarily fit into 31 bit int. *)
+ try Some (Int64.of_string t)
+ with Failure "int_of_string" -> assert false
)
) files in
let times = List.rev (List.sort compare times) in
)
) files in
let times = List.rev (List.sort compare times) in
@@
-319,11
+321,11
@@
and reload_files () =
(* Unlink the older files. *)
List.iter (
fun t ->
(* Unlink the older files. *)
List.iter (
fun t ->
- try unlink (dir // sprintf "jobs__%d%s" t suffix)
+ try unlink (dir // sprintf "jobs__%
L
d%s" t suffix)
with Unix_error _ -> ()
) xs;
(* Return the newest (highest numbered) file. *)
with Unix_error _ -> ()
) xs;
(* Return the newest (highest numbered) file. *)
- Some (dir // sprintf "jobs__%d%s" x suffix) in
+ Some (dir // sprintf "jobs__%
L
d%s" x suffix) in
(* As we are reloading the file, we want to create a new state
* that has no jobs, but has all the variables from the previous
(* As we are reloading the file, we want to create a new state
* that has no jobs, but has all the variables from the previous