summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/libssh/sftp.h3
-rw-r--r--libssh/sftp.c14
2 files changed, 9 insertions, 8 deletions
diff --git a/include/libssh/sftp.h b/include/libssh/sftp.h
index 3086beb..f5368a1 100644
--- a/include/libssh/sftp.h
+++ b/include/libssh/sftp.h
@@ -340,7 +340,8 @@ int sftp_file_close(SFTP_FILE *file) SFTP_DEPRECATED;
* @return A sftp file handle, NULL on error with ssh and sftp
* error set.
*/
-SFTP_FILE *sftp_open(SFTP_SESSION *session, const char *file, int access, mode_t mode);
+SFTP_FILE *sftp_open(SFTP_SESSION *session, const char *file, int flags,
+ mode_t mode);
void sftp_file_set_nonblocking(SFTP_FILE *handle);
diff --git a/libssh/sftp.c b/libssh/sftp.c
index 54446ee..c00d167 100644
--- a/libssh/sftp.c
+++ b/libssh/sftp.c
@@ -987,7 +987,7 @@ int sftp_closedir(SFTP_DIR *dir){
}
/* Open a file on the server. */
-SFTP_FILE *sftp_open(SFTP_SESSION *sftp, const char *file, int access, mode_t mode){
+SFTP_FILE *sftp_open(SFTP_SESSION *sftp, const char *file, int flags, mode_t mode){
SFTP_FILE *handle;
SFTP_MESSAGE *msg=NULL;
STATUS_MESSAGE *status;
@@ -1001,17 +1001,17 @@ SFTP_FILE *sftp_open(SFTP_SESSION *sftp, const char *file, int access, mode_t mo
attr.permissions = mode;
attr.flags = SSH_FILEXFER_ATTR_PERMISSIONS;
- if(access == O_RDONLY)
+ if(flags == O_RDONLY)
flags|=SSH_FXF_READ; // if any of the other flag is set, READ should not be set initialy
- if(access & O_WRONLY)
+ if(flags & O_WRONLY)
flags |= SSH_FXF_WRITE;
- if(access & O_RDWR)
+ if(flags & O_RDWR)
flags|=(SSH_FXF_WRITE | SSH_FXF_READ);
- if(access & O_CREAT)
+ if(flags & O_CREAT)
flags |=SSH_FXF_CREAT;
- if(access & O_TRUNC)
+ if(flags & O_TRUNC)
flags |=SSH_FXF_TRUNC;
- if(access & O_EXCL)
+ if(flags & O_EXCL)
flags |= SSH_FXF_EXCL;
buffer_add_u32(buffer,id);
filename=string_from_char(file);