Bug 5805 - Second call to smbc_init_context closes STDOUT
Second call to smbc_init_context closes STDOUT
Status: RESOLVED FIXED
Product: Samba 3.2
Classification: Unclassified
Component: libsmbclient
3.2.4
x64 Linux
: P3 critical
: ---
Assigned To: Derrell Lipman
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-10-02 03:59 UTC by Henrik
Modified: 2008-10-02 09:20 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Henrik 2008-10-02 03:59:30 UTC
Using libsmbclient in 3-2-stable it looks like smbc_init_context always closes STDOUT the second time it is run.

Below is modified version of the test code found in examples/libsmbclient/testctx.c
------------------------------------------------------------------------------------
#include <libsmbclient.h>
#include <stdio.h>

void create_and_destroy_context (void)
{
	printf( "a\n" );
	SMBCCTX *ctx;
	ctx = smbc_new_context ();
	printf( "b\n" );
	smbc_init_context (ctx);
	printf( "c\n" );

	smbc_free_context (ctx, 1);
	printf( "d\n" );
}

int main (int argc, char **argv)
{
	printf( "first\n" );
	create_and_destroy_context ();
	printf( "second\n" );
	create_and_destroy_context ();
	return 0;
}
------------------------------------------------------------------------------------


$ /usr/local/samba/bin/smbclient --version
Version 3.2.5

$ gcc test2.c -I/usr/local/samba/include -L/usr/local/samba/lib -lsmbclient
$ ./a.out
first
a
b
c
d
second
a
b
Comment 1 Derrell Lipman 2008-10-02 07:27:56 UTC
to me
Comment 2 Derrell Lipman 2008-10-02 09:20:49 UTC
Fixed in branches v3-2-test and master. 

Derrell