mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-29 16:54:51 +02:00
fix pester test failures
This commit is contained in:
parent
215341dd66
commit
f4d2ff0409
@ -268,14 +268,27 @@ readdir(void *avp)
|
||||
char *
|
||||
basename(char *path)
|
||||
{
|
||||
char *pdest;
|
||||
char *pdest;
|
||||
const char *endp;
|
||||
static char bname[PATH_MAX];
|
||||
|
||||
/* Find any trailing slashes */
|
||||
endp = path + strlen(path) - 1;
|
||||
while (endp > path && (*endp == '/' || *endp == '\\'))
|
||||
endp--;
|
||||
|
||||
int path_len = endp - path + 1;
|
||||
if (strncpy_s(bname, PATH_MAX, path, path_len + 1)) {
|
||||
return NULL;
|
||||
}
|
||||
bname[path_len] = '\0';
|
||||
|
||||
if (!path)
|
||||
return ".";
|
||||
pdest = strrchr(path, '/');
|
||||
pdest = strrchr(bname, '/');
|
||||
if (pdest)
|
||||
return (pdest + 1);
|
||||
pdest = strrchr(path, '\\');
|
||||
pdest = strrchr(bname, '\\');
|
||||
if (pdest)
|
||||
return (pdest + 1);
|
||||
|
||||
|
@ -1819,6 +1819,11 @@ do_download(struct sftp_conn *conn, const char *remote_path,
|
||||
status = SSH2_FX_FAILURE;
|
||||
else
|
||||
status = SSH2_FX_OK;
|
||||
#ifdef WINDOWS
|
||||
if (add_mark_of_web(local_path) == -1) {
|
||||
debug("%s: failed to add mark of the web", local_path);
|
||||
}
|
||||
#endif // WINDOWS
|
||||
/* Override umask and utimes if asked */
|
||||
#ifdef HAVE_FCHMOD
|
||||
if (preserve_flag && fchmod(local_fd, mode) == -1)
|
||||
@ -1847,11 +1852,6 @@ do_download(struct sftp_conn *conn, const char *remote_path,
|
||||
}
|
||||
}
|
||||
close(local_fd);
|
||||
#ifdef WINDOWS
|
||||
if (add_mark_of_web(local_path) == -1) {
|
||||
debug("%s: failed to add mark of the web", local_path);
|
||||
}
|
||||
#endif // WINDOWS
|
||||
sshbuf_free(msg);
|
||||
free(handle);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user