From 4ae71b4838d4b60fede5c93980e3ad15e2fed688 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 27 Oct 2010 22:59:32 +0200 Subject: [PATCH] libssh2_userauth_authenticated: make it work as documented The man page clearly says it returns 1 for "already authenticated" but the code said non-zero. I changed the code to use 1 now, as that is also non-zero but it gets the benefit that it now matches the documentation. Using 1 instead of non-zero is better for two reasons: 1. We have the opportunity to introduce other return codes in the future for things like error and what not. 2. We don't expose the internal bitmask variable value. --- src/userauth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/userauth.c b/src/userauth.c index 913a00b..bfbc1a6 100644 --- a/src/userauth.c +++ b/src/userauth.c @@ -179,12 +179,12 @@ libssh2_userauth_list(LIBSSH2_SESSION * session, const char *user, * libssh2_userauth_authenticated * * Returns: 0 if not yet authenticated - * non-zero is already authenticated + * 1 if already authenticated */ LIBSSH2_API int libssh2_userauth_authenticated(LIBSSH2_SESSION * session) { - return session->state & LIBSSH2_STATE_AUTHENTICATED; + return (session->state & LIBSSH2_STATE_AUTHENTICATED)?1:0; }