From d4ed84e4cb15305d763a3acb16d8cf8693c65840 Mon Sep 17 00:00:00 2001 From: "djm@openbsd.org" Date: Tue, 22 Sep 2026 22:29:27 +0000 Subject: [PATCH] upstream: ssh-agent: fix socket cleanup for -a option (no pathspec) from markus@ ok me OpenBSD-Commit-ID: 3194c1ed609eaa05932b9f6036ace7561e140627 --- misc-agent.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/misc-agent.c b/misc-agent.c index 9a936938d..fc62dc601 100644 --- a/misc-agent.c +++ b/misc-agent.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc-agent.c,v 1.10 2026/09/16 07:47:29 jsg Exp $ */ +/* $OpenBSD: misc-agent.c,v 1.11 2026/09/22 22:29:27 djm Exp $ */ /* * Copyright (c) 2025 Damien Miller * @@ -321,7 +321,7 @@ int agent_listener_cleanup(const char *pathspec, const char *sockpath, const char *sockdir) { - if (sockpath == NULL || pathspec == NULL) + if (sockpath == NULL) return 0; if (unlink(sockpath) != 0) { error_f("unlink \"%s\": %s", sockpath, strerror(errno)); @@ -329,6 +329,8 @@ agent_listener_cleanup(const char *pathspec, const char *sockpath, } debug3_f("removed socket %s", sockpath); + if (pathspec == NULL) + return 0; if (strncmp(pathspec, "shared:", 7) == 0 && sockdir != NULL) { if (rmdir(sockdir) != 0) { error_f("rmdir \"%s\": %s", sockdir, strerror(errno));