Skip to content

Commit d6f9d22

Browse files
committed
update freedesktop_entry_parser to 2.0.1
Signed-off-by: reubenmiller <[email protected]>
1 parent 66f3ae5 commit d6f9d22

File tree

3 files changed

+39
-24
lines changed

3 files changed

+39
-24
lines changed

Cargo.lock

Lines changed: 23 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ fastrand = "2.0"
114114
figment = { version = "0.10" }
115115
filetime = "0.2"
116116
flate2 = "1.1.1"
117-
freedesktop_entry_parser = "1.3.0"
117+
freedesktop_entry_parser = "2.0.1"
118118
futures = "0.3"
119119
futures-util = "0.3.25"
120120
glob = "0.3"

crates/core/tedge_watchdog/src/systemd_watchdog.rs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -287,16 +287,22 @@ fn notify_systemd(pid: u32, status: &str) -> Result<ExitStatus, WatchdogError> {
287287

288288
fn get_watchdog_sec(service_file: &str) -> Result<u64, WatchdogError> {
289289
let entry = parse_entry(service_file)?;
290-
if let Some(interval) = entry.section("Service").attr("WatchdogSec") {
291-
match interval.parse::<u64>() {
292-
Ok(i) => Ok(i),
293-
Err(e) => {
294-
error!(
295-
"Failed to parse the to WatchdogSec to integer from {}",
296-
service_file
297-
);
298-
Err(WatchdogError::ParseWatchdogSecToInt(e))
290+
if let Some(service_section) = entry.section("Service") {
291+
if let Some(interval) = service_section.attr("WatchdogSec").get(0) {
292+
match interval.parse::<u64>() {
293+
Ok(i) => Ok(i),
294+
Err(e) => {
295+
error!(
296+
"Failed to parse the to WatchdogSec to integer from {}",
297+
service_file
298+
);
299+
Err(WatchdogError::ParseWatchdogSecToInt(e))
300+
}
299301
}
302+
} else {
303+
Err(WatchdogError::NoWatchdogSec {
304+
file: service_file.to_string(),
305+
})
300306
}
301307
} else {
302308
Err(WatchdogError::NoWatchdogSec {

0 commit comments

Comments
 (0)