summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorRichard Sharpe <sharpe@samba.org>2004-05-09 17:29:09 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:51:31 -0500
commit80728c70456dd30c86bcfed460212dc95d7fb02d (patch)
tree20ab5c50d50c14ccd219ac8dd178033426938f7b /source3/libsmb
parentc9f1b5b02260758a3e508fe5e4bff70cf32eef31 (diff)
downloadsamba-80728c70456dd30c86bcfed460212dc95d7fb02d.tar.gz
samba-80728c70456dd30c86bcfed460212dc95d7fb02d.tar.bz2
samba-80728c70456dd30c86bcfed460212dc95d7fb02d.zip
r616: Bug #1333.
Make sure we return an error code when things go wrong. (This used to be commit 21cdb45b54662c7835aea1d16fdd5902cf7a7496)
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/libsmbclient.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c
index 417b5ba8d4..949c5ffab6 100644
--- a/source3/libsmb/libsmbclient.c
+++ b/source3/libsmb/libsmbclient.c
@@ -680,12 +680,18 @@ SMBCSRV *smbc_server(SMBCCTX *context,
srv->cli = c;
srv->dev = (dev_t)(str_checksum(server) ^ str_checksum(share));
- /* now add it to the cache (internal or external) */
+ /* now add it to the cache (internal or external) */
+ /* Let the cache function set errno if it wants to */
+ errno = 0;
if (context->callbacks.add_cached_srv_fn(context, srv, server, share, workgroup, username)) {
+ int saved_errno = errno;
DEBUG(3, (" Failed to add server to cache\n"));
+ saved_errno = errno;
+ if (errno == 0) {
+ errno = ENOMEM;
+ }
goto failed;
}
-
DEBUG(2, ("Server connect ok: //%s/%s: %p\n",
server, share, srv));