Clarify usage of sftpfs_internal_stat() return value.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2017-01-16 11:26:36 +03:00
parent 77a273a0fd
commit a3b54e4003

View File

@ -290,12 +290,13 @@ sftpfs_lstat (const vfs_path_t * vpath, struct stat *buf, GError ** mcerror)
int res;
res = sftpfs_stat_init (&super_data, &path_element, vpath, mcerror, LIBSSH2_SFTP_LSTAT, &attrs);
if (res == -1 || res == -EACCES || res == -ENOENT)
return res;
if (res >= 0)
{
sftpfs_attr_to_stat (&attrs, buf);
res = 0;
}
sftpfs_attr_to_stat (&attrs, buf);
return 0;
return res;
}
/* --------------------------------------------------------------------------------------------- */
@ -317,14 +318,14 @@ sftpfs_stat (const vfs_path_t * vpath, struct stat *buf, GError ** mcerror)
int res;
res = sftpfs_stat_init (&super_data, &path_element, vpath, mcerror, LIBSSH2_SFTP_STAT, &attrs);
if (res == -1 || res == -EACCES || res == -ENOENT)
return res;
if (res >= 0)
{
buf->st_nlink = 1;
sftpfs_attr_to_stat (&attrs, buf);
res = 0;
}
buf->st_nlink = 1;
sftpfs_attr_to_stat (&attrs, buf);
return 0;
return res;
}
/* --------------------------------------------------------------------------------------------- */
@ -438,7 +439,7 @@ sftpfs_chmod (const vfs_path_t * vpath, mode_t mode, GError ** mcerror)
int res;
res = sftpfs_stat_init (&super_data, &path_element, vpath, mcerror, LIBSSH2_SFTP_LSTAT, &attrs);
if (res == -1 || res == -EACCES || res == -ENOENT)
if (res < 0)
return res;
attrs.permissions = mode;