MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / libssh_delete

Function libssh_delete

libavformat/libssh.c:393–427  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

391}
392
393static int libssh_delete(URLContext *h)
394{
395 int ret;
396 LIBSSHContext *libssh = h->priv_data;
397 sftp_attributes attr = NULL;
398 char path[MAX_URL_SIZE];
399
400 if ((ret = libssh_connect(h, h->filename, path, sizeof(path))) < 0)
401 goto cleanup;
402
403 if (!(attr = sftp_stat(libssh->sftp, path))) {
404 ret = AVERROR(sftp_get_error(libssh->sftp));
405 goto cleanup;
406 }
407
408 if (attr->type == SSH_FILEXFER_TYPE_DIRECTORY) {
409 if (sftp_rmdir(libssh->sftp, path) < 0) {
410 ret = AVERROR(sftp_get_error(libssh->sftp));
411 goto cleanup;
412 }
413 } else {
414 if (sftp_unlink(libssh->sftp, path) < 0) {
415 ret = AVERROR(sftp_get_error(libssh->sftp));
416 goto cleanup;
417 }
418 }
419
420 ret = 0;
421
422cleanup:
423 if (attr)
424 sftp_attributes_free(attr);
425 libssh_close(h);
426 return ret;
427}
428
429static int libssh_move(URLContext *h_src, URLContext *h_dst)
430{

Callers

nothing calls this directly

Calls 2

libssh_connectFunction · 0.85
libssh_closeFunction · 0.85

Tested by

no test coverage detected