mirror of
https://github.com/netbirdio/netbird.git
synced 2026-05-29 20:19:56 +00:00
Handle Lstat error in purgeStaleAgentSubdir
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user