diff options
-rw-r--r-- | source3/libsmb/libsmbclient.c | 10 |
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)); |