Commit 80728c70 authored by Richard Sharpe's avatar Richard Sharpe Committed by Gerald (Jerry) Carter
Browse files

r616: Bug #1333.

Make sure we return an error code when things go wrong.
(This used to be commit 21cdb45b54662c7835aea1d16fdd5902cf7a7496)
parent c9f1b5b0
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -681,12 +681,18 @@ SMBCSRV *smbc_server(SMBCCTX *context,
	srv->dev = (dev_t)(str_checksum(server) ^ str_checksum(share));

	/* 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));