File 1268-ssh-Handle-eacces-like-enoent-in-ssh_sftpd-get_attrs.patch of Package erlang
From 14c0f904a2590465c0f5f2f49ad55039b49b22b7 Mon Sep 17 00:00:00 2001
From: Hans Nilsson <hans@erlang.org>
Date: Thu, 26 Aug 2021 15:44:44 +0200
Subject: [PATCH] ssh: Handle eacces like enoent in ssh_sftpd:get_attrs/6
---
lib/ssh/src/ssh_sftpd.erl | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/ssh/src/ssh_sftpd.erl b/lib/ssh/src/ssh_sftpd.erl
index 1c53690ed0..2d755e874a 100644
--- a/lib/ssh/src/ssh_sftpd.erl
+++ b/lib/ssh/src/ssh_sftpd.erl
@@ -564,7 +564,10 @@ get_attrs(RelPath, [F | Rest], FileMod, FS0, Vsn, Acc) ->
end,
Attrs = ssh_sftp:info_to_attr(Info),
get_attrs(RelPath, Rest, FileMod, FS1, Vsn, [{Name, Attrs} | Acc]);
- {{error, enoent}, FS1} ->
+ {{error, Msg}, FS1} when
+ Msg == enoent ; % The item has disappeared after reading the list of items to check
+ Msg == eacces -> % You are not allowed to read this
+ %% Skip this F and check the remaining Rest
get_attrs(RelPath, Rest, FileMod, FS1, Vsn, Acc);
{Error, FS1} ->
{Error, FS1}
--
2.31.1