1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-26 01:03:15 +03:00

sftp: Do not always set SSH_FXF_READ

Comparison ((flags & O_RDONLY) == O_RDONLY) is always true.
Also, O_RDWR, O_WRONLY and O_RDONLY are mutually exclusive => no need to check all of them

Signed-off-by: Tilo Eckert <tilo.eckert@flam.de>
This commit is contained in:
Tilo Eckert
2016-06-30 12:27:43 +02:00
committed by Andreas Schneider
parent f561e6bcb3
commit cfe7065ce1

View File

@@ -1626,12 +1626,13 @@ sftp_file sftp_open(sftp_session sftp, const char *file, int flags,
attr.permissions = mode;
attr.flags = SSH_FILEXFER_ATTR_PERMISSIONS;
if ((flags & O_RDONLY) == O_RDONLY)
sftp_flags |= SSH_FXF_READ;
if ((flags & O_WRONLY) == O_WRONLY)
sftp_flags |= SSH_FXF_WRITE;
if ((flags & O_RDWR) == O_RDWR)
if ((flags & O_RDWR) == O_RDWR) {
sftp_flags |= (SSH_FXF_WRITE | SSH_FXF_READ);
} else if ((flags & O_WRONLY) == O_WRONLY) {
sftp_flags |= SSH_FXF_WRITE;
} else {
sftp_flags |= SSH_FXF_READ;
}
if ((flags & O_CREAT) == O_CREAT)
sftp_flags |= SSH_FXF_CREAT;
if ((flags & O_TRUNC) == O_TRUNC)