bool SFTPChannel::updateMkDir() { QByteArray path = mCurrentRequest->getPath().toUtf8(); int rc = libssh2_sftp_mkdir_ex(mHandle, path, path.length(), 0644); if (rc == LIBSSH2_ERROR_EAGAIN) return true; // Try again. else if (rc < 0) mCurrentRequest->triggerFailure(tr("Failed to create remote directory: %1").arg(rc), 0); else mCurrentRequest->triggerSuccess(QVariantMap()); return false; }
int sftpfs_mkdir (const vfs_path_t * vpath, mode_t mode, GError ** error) { int res; struct vfs_s_super *super; sftpfs_super_data_t *super_data; const vfs_path_element_t *path_element; path_element = vfs_path_get_by_index (vpath, -1); if (vfs_s_get_path (vpath, &super, 0) == NULL) return -1; if (super == NULL) return -1; super_data = (sftpfs_super_data_t *) super->data; if (super_data->sftp_session == NULL) return -1; do { const char *fixfname; fixfname = sftpfs_fix_filename (path_element->path); res = libssh2_sftp_mkdir_ex (super_data->sftp_session, fixfname, sftpfs_filename_buffer->len, mode); if (res >= 0) break; if (res != LIBSSH2_ERROR_EAGAIN) { sftpfs_ssherror_to_gliberror (super_data, res, error); return -1; } sftpfs_waitsocket (super_data, error); if (error != NULL && *error != NULL) return -1; } while (res == LIBSSH2_ERROR_EAGAIN); return res; }