Commit bddd79db authored by Seblu's avatar Seblu
Browse files

checkservices: do not restart services with deleted memfd

Do not restart a process if it has a deleted path starting with /memfd:.
This behavior prevents unintended restarts of services, such as Jellyfin, that may have deleted memfds.
parent e21b6776
Loading
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -124,8 +124,9 @@ get_broken_maps() {
                continue
            }
            # only file mapped as executable
            # do not use awk fields sepration, path may contain spaces
            deleted="$(awk '/^\S+ ..x. .+\(deleted\)$/ {sub(/^(\S+\s+){5}/,""); sub(/ \(deleted\)$/,""); print}' "$maps_path")"
            # use awk fields separation with caution, path may contain spaces
            # deleted /memfd: paths don't mean process need to be restarted (e.g. jellyfin)
            deleted="$(awk '/^\S+ ..x. .+\(deleted\)$/ && $6 !~ /^\/memfd:/ {print}' "$maps_path")"
            if [[ $deleted ]]; then
                printf "%s\n" $service
                break