1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-21 02:50:18 +03:00

Merge pull request #13368 from keszybz/close-watchdog

shared/watchdog: close watchdog device when done with it
This commit is contained in:
Lennart Poettering 2019-08-21 15:36:02 +02:00 committed by GitHub
commit 2de1ce6838
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -82,7 +82,16 @@ static int open_watchdog(void) {
}
int watchdog_set_device(char *path) {
return free_and_strdup(&watchdog_device, path);
int r;
r = free_and_strdup(&watchdog_device, path);
if (r < 0)
return r;
if (r > 0) /* watchdog_device changed */
watchdog_fd = safe_close(watchdog_fd);
return r;
}
int watchdog_set_timeout(usec_t *usec) {