From cdde79418a86da1c9579a022ec8c4ed73fe29f1a Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 27 Jul 2009 14:20:32 +0200 Subject: [PATCH] Add ssh_file_readaccess_ok to check read access on a file. --- libssh/misc.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libssh/misc.c b/libssh/misc.c index 5ab0501d..0df11464 100644 --- a/libssh/misc.c +++ b/libssh/misc.c @@ -77,6 +77,15 @@ char *ssh_get_user_home_dir(void) { return NULL; } + + /* we have read access on file */ + int ssh_file_readaccess_ok(const char *file) { + if (_access(file, 4) < 0) { + return 0; + } + + return 1; +} #else /* _WIN32 */ char *ssh_get_user_home_dir(void) {