[PATCH][RESEND] apply the struct dirent penalty only when needed
vinschen at redhat.com
Fri Oct 13 02:51:19 AEDT 2017
On Oct 12 11:57, Rolf Eike Beer wrote:
> Subject: [PATCH 1/3] apply the struct dirent penalty only when needed
> Many systems have a struct dirent that already has enough space to hold the
> entries names, others like Solaris have not. For the latter extra space needs
> to be allocated, but this was also done for the former systems leading to
> needlessly reserved memory.
> sftp-glob.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
> diff --git a/sftp-glob.c b/sftp-glob.c
> index 43a1beba..8edd28ac 100644
> --- a/sftp-glob.c
> +++ b/sftp-glob.c
> @@ -64,9 +64,14 @@ fudge_opendir(const char *path)
> static struct dirent *
> fudge_readdir(struct SFTP_OPENDIR *od)
> +#ifdef BROKEN_ONE_BYTE_DIRENT_D_NAME
> /* Solaris needs sizeof(dirent) + path length (see below) */
> static char buf[sizeof(struct dirent) + MAXPATHLEN];
I know this code was already there, but isn't MAXPATHLEN rather wasteful?
Shouldn't that be NAME_LEN + 1 instead?
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 819 bytes
Desc: not available
More information about the openssh-unix-dev