=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/ssh.c,v retrieving revision 1.551 retrieving revision 1.552 diff -u -r1.551 -r1.552 --- src/usr.bin/ssh/ssh.c 2021/02/15 20:43:15 1.551 +++ src/usr.bin/ssh/ssh.c 2021/02/23 00:05:31 1.552 @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh.c,v 1.551 2021/02/15 20:43:15 markus Exp $ */ +/* $OpenBSD: ssh.c,v 1.552 2021/02/23 00:05:31 djm Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -1398,6 +1398,12 @@ free(p); free(options.forward_agent_sock_path); options.forward_agent_sock_path = cp; + if (stat(options.forward_agent_sock_path, &st) != 0) { + error("Cannot forward agent socket path \"%s\": %s", + options.forward_agent_sock_path, strerror(errno)); + if (options.exit_on_forward_failure) + cleanup_exit(255); + } } if (options.num_system_hostfiles > 0 &&