Skip to content

Commit 1b749c9

Browse files
committed
- Fix reprogram_file file system handling.
1 parent 3bc3c37 commit 1b749c9

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/frame_socket_server.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,11 @@ fn handle_payload_from_frame_acquire_thread(
254254
.expect("Failed reading file metadata");
255255
let created = metadata.modified().unwrap_or_else(|_| {
256256
let timestamp_str = fs::read(reprogram_file)
257-
.and_then(|file_contents| {
258-
Ok(String::from_utf8(file_contents)
259-
.unwrap_or(String::from("0")))
257+
.map(|file_contents| {
258+
String::from_utf8(file_contents)
259+
.unwrap_or(String::from("0"))
260260
})
261-
.expect("Should get timestamp string");
261+
.expect("Failed getting timestamp string");
262262
let timestamp_seconds =
263263
timestamp_str.parse::<u64>().unwrap_or(0);
264264
let timestamp = Duration::from_secs(timestamp_seconds);
@@ -279,11 +279,8 @@ fn handle_payload_from_frame_acquire_thread(
279279
.duration_since(UNIX_EPOCH)
280280
.expect("Time went backwards")
281281
.as_secs_f64();
282-
fs::write(
283-
reprogram_file,
284-
String::from(format!("{timestamp_seconds}")),
285-
)
286-
.expect("Failed writing reprogram placeholder file");
282+
fs::write(reprogram_file, format!("{timestamp_seconds}"))
283+
.expect("Failed writing reprogram placeholder file");
287284
process::exit(0)
288285
}
289286
Err(e) => {

0 commit comments

Comments
 (0)