Skip to content

Commit

Permalink
Don't fail if lock link didn't exist in the first place
Browse files Browse the repository at this point in the history
  • Loading branch information
lpereira committed Aug 25, 2021
1 parent 3f66973 commit 2500c65
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions hibernation-setup-tool.c
Original file line number Diff line number Diff line change
Expand Up @@ -1388,8 +1388,10 @@ static int handle_pre_systemd_suspend_notification(const char *action)
close(fd);

if (unlink(hibernate_lock_file_name) < 0) {
notify_vm_host(HOST_VM_NOTIFY_PRE_HIBERNATION_FAILED);
log_fatal("Couldn't remove %s: %s", hibernate_lock_file_name, strerror(errno));
if (errno != EEXIST) {
notify_vm_host(HOST_VM_NOTIFY_PRE_HIBERNATION_FAILED);
log_fatal("Couldn't remove %s: %s", hibernate_lock_file_name, strerror(errno));
}
}
if (link(pattern, hibernate_lock_file_name) < 0) {
notify_vm_host(HOST_VM_NOTIFY_PRE_HIBERNATION_FAILED);
Expand Down

0 comments on commit 2500c65

Please sign in to comment.