mirror of
https://github.com/libssh2/libssh2.git
synced 2025-08-29 08:01:59 +03:00
To simplify the user's error interface always use LIBSSH2_ERROR_EAGAIN.
LIBSSH2CHANNEL_EAGAIN and LIBSSH2SFTP_EAGAIN are still valid, but are defined as LIBSSH2_ERROR_EAGAIN.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: sftpdir_nonblock.c,v 1.6 2007/06/07 16:01:14 jehousley Exp $
|
||||
* $Id: sftpdir_nonblock.c,v 1.7 2007/06/08 13:33:08 jehousley Exp $
|
||||
*
|
||||
* Sample doing an SFTP directory listing.
|
||||
*
|
||||
@@ -127,7 +127,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (auth_pw) {
|
||||
/* We could authenticate via password */
|
||||
while ((rc = libssh2_userauth_password(session, username, password)) == LIBSSH2CHANNEL_EAGAIN);
|
||||
while ((rc = libssh2_userauth_password(session, username, password)) == LIBSSH2_ERROR_EAGAIN);
|
||||
if (rc) {
|
||||
fprintf(stderr, "Authentication by password failed.\n");
|
||||
goto shutdown;
|
||||
@@ -137,7 +137,7 @@ int main(int argc, char *argv[])
|
||||
while ((rc = libssh2_userauth_publickey_fromfile(session, username,
|
||||
"/home/username/.ssh/id_rsa.pub",
|
||||
"/home/username/.ssh/id_rsa",
|
||||
password)) == LIBSSH2CHANNEL_EAGAIN);
|
||||
password)) == LIBSSH2_ERROR_EAGAIN);
|
||||
if (rc) {
|
||||
fprintf(stderr, "\tAuthentication by public key failed\n");
|
||||
goto shutdown;
|
||||
@@ -171,7 +171,7 @@ int main(int argc, char *argv[])
|
||||
LIBSSH2_SFTP_ATTRIBUTES attrs;
|
||||
|
||||
/* loop until we fail */
|
||||
while ((rc = libssh2_sftp_readdir(sftp_handle, mem, sizeof(mem), &attrs)) == LIBSSH2SFTP_EAGAIN) {
|
||||
while ((rc = libssh2_sftp_readdir(sftp_handle, mem, sizeof(mem), &attrs)) == LIBSSH2_ERROR_EAGAIN) {
|
||||
;
|
||||
}
|
||||
if(rc > 0) {
|
||||
@@ -204,7 +204,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
printf("%s\n", mem);
|
||||
}
|
||||
else if (rc == LIBSSH2SFTP_EAGAIN) {
|
||||
else if (rc == LIBSSH2_ERROR_EAGAIN) {
|
||||
/* blocking */
|
||||
fprintf(stderr, "Blocking\n");
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user