Handle Lstat error in purgeStaleAgentSubdir

This commit is contained in:
Viktor Liu
2026-05-25 15:52:30 +02:00
parent 6cd5d6084f
commit 6c9465df54

View File

@@ -188,9 +188,12 @@ func ensureAgentSocketParent(parent string) error {
// owned by uid with mode 0700. Lstat (not Stat) so a symlink is detected.
func purgeStaleAgentSubdir(subdir string, uid uint32) error {
info, err := os.Lstat(subdir)
if err != nil {
if errors.Is(err, os.ErrNotExist) {
return nil
}
if err != nil {
return fmt.Errorf("lstat %s: %w", subdir, err)
}
if agentSubdirOK(info, uid) {
return nil
}