mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-11-27 13:21:11 +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:
committed by
Andreas Schneider
parent
f561e6bcb3
commit
cfe7065ce1
11
src/sftp.c
11
src/sftp.c
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user