diff options
author | Andreas Schneider <mail@cynapses.org> | 2009-07-27 14:20:32 +0200 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2009-07-27 14:20:32 +0200 |
commit | cdde79418a86da1c9579a022ec8c4ed73fe29f1a (patch) | |
tree | 5eb5de9aa78b44b7c5505e6600af9e280604ba6b | |
parent | 9b97da65e6c752a225a3f4cc05a792a4a90a96b5 (diff) | |
download | libssh-cdde79418a86da1c9579a022ec8c4ed73fe29f1a.tar.gz libssh-cdde79418a86da1c9579a022ec8c4ed73fe29f1a.tar.xz libssh-cdde79418a86da1c9579a022ec8c4ed73fe29f1a.zip |
Add ssh_file_readaccess_ok to check read access on a file.
-rw-r--r-- | libssh/misc.c | 9 |
1 files changed, 9 insertions, 0 deletions
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) { |