1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

nanocoap_vfs: don't close socket in nanocoap_vfs_put()

This commit is contained in:
Benjamin Valentin 2022-10-31 15:56:10 +01:00 committed by Benjamin Valentin
parent 780309d71a
commit 3877a92ca4

View File

@ -114,8 +114,6 @@ static int _vfs_put(coap_block_request_t *ctx, const char *file, void *buffer)
vfs_lseek(fd, -1, SEEK_CUR);
}
nanocoap_block_request_done(ctx);
vfs_close(fd);
return res;
}
@ -151,9 +149,10 @@ int nanocoap_vfs_put_url(const char *url, const char *src,
coap_block_request_t ctx;
int res = nanocoap_block_request_init_url(&ctx, url, COAP_METHOD_PUT,
coap_size2szx(work_buf_len - 1));
if (res) {
return res;
if (res == 0) {
res = _vfs_put(&ctx, src, work_buf);
nanocoap_block_request_done(&ctx);
}
return _vfs_put(&ctx, src, work_buf);
return res;
}