Skip to content

Commit 01e7777

Browse files
authored
Merge pull request #835 from JacobBarthelmeh/mplabx
fixes for mplabx build
2 parents e5e73c9 + d85b5cb commit 01e7777

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/wolfsftp.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2136,7 +2136,11 @@ int wolfSSH_SFTP_RecvOpen(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
21362136
res = ier;
21372137
if (wolfSSH_SFTP_CreateStatus(ssh, WOLFSSH_FTP_FAILURE, reqId, res,
21382138
"English", NULL, &outSz) != WS_SIZE_ONLY) {
2139+
#ifdef MICROCHIP_MPLAB_HARMONY
2140+
WFCLOSE(ssh->fs, &fd);
2141+
#else
21392142
WCLOSE(ssh->fs, fd);
2143+
#endif
21402144
return WS_FATAL_ERROR;
21412145
}
21422146
ret = WS_FATAL_ERROR;
@@ -2148,14 +2152,22 @@ int wolfSSH_SFTP_RecvOpen(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
21482152
/* create packet */
21492153
out = (byte*)WMALLOC(outSz, ssh->ctx->heap, DYNTYPE_BUFFER);
21502154
if (out == NULL) {
2155+
#ifdef MICROCHIP_MPLAB_HARMONY
2156+
WFCLOSE(ssh->fs, &fd);
2157+
#else
21512158
WCLOSE(ssh->fs, fd);
2159+
#endif
21522160
return WS_MEMORY_E;
21532161
}
21542162
}
21552163
if (ret == WS_SUCCESS) {
21562164
if (SFTP_CreatePacket(ssh, WOLFSSH_FTP_HANDLE, out, outSz,
21572165
(byte*)&fd, sizeof(WFD)) != WS_SUCCESS) {
2166+
#ifdef MICROCHIP_MPLAB_HARMONY
2167+
WFCLOSE(ssh->fs, &fd);
2168+
#else
21582169
WCLOSE(ssh->fs, fd);
2170+
#endif
21592171
return WS_FATAL_ERROR;
21602172
}
21612173
}
@@ -2164,7 +2176,11 @@ int wolfSSH_SFTP_RecvOpen(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
21642176
"English", out, &outSz) != WS_SUCCESS) {
21652177
WFREE(out, ssh->ctx->heap, DYNTYPE_BUFFER);
21662178
if (fd >= 0) {
2179+
#ifdef MICROCHIP_MPLAB_HARMONY
2180+
WFCLOSE(ssh->fs, &fd);
2181+
#else
21672182
WCLOSE(ssh->fs, fd);
2183+
#endif
21682184
}
21692185
return WS_FATAL_ERROR;
21702186
}
@@ -5039,7 +5055,7 @@ int SFTP_GetAttributes(void* fs, const char* fileName, WS_SFTP_FILEATRB* atr,
50395055
int SFTP_GetAttributes_Handle(WOLFSSH* ssh, byte* handle, int handleSz,
50405056
char* name, WS_SFTP_FILEATRB* atr)
50415057
{
5042-
return SFTP_GetAttributesHelper(atr, cur->name);
5058+
return SFTP_GetAttributesHelper(atr, name);
50435059
}
50445060

50455061
#else

0 commit comments

Comments
 (0)