1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-27 02:56:18 -04:00

Bug 844, SMB: EACCES from smbc_opendir beats ENOENT from smbc_open.

This commit is contained in:
Kalle Olavi Niemitalo 2007-02-25 23:40:43 +02:00 committed by Kalle Olavi Niemitalo
parent 8a25be932b
commit 0212ba7e93

View File

@ -305,12 +305,21 @@ do_smb(struct connection *conn)
if (dir >= 0) {
smb_directory(dir, conn->uri);
} else {
const int errno_from_opendir = errno;
char buf[READ_SIZE];
struct stat sb;
int r, res;
int file = smbc_open(url, O_RDONLY, 0);
if (file < 0) {
/* If we're opening the list of shares without
* proper authentication, then smbc_opendir
* fails with EACCES and smbc_open fails with
* ENOENT. In this case, return the EACCES so
* that the parent ELinks process will prompt
* for credentials. */
if (errno == ENOENT && errno_from_opendir == EACCES)
errno = errno_from_opendir;
smb_error(errno);
}