The Samba-Bugzilla – Attachment 11286 Details for
Bug 11413
Crash when using multiple contexts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
tet program
testnotify.c (text/x-csrc), 2.35 KB, created by
Ross Lagerwall
on 2015-07-26 15:56:05 UTC
(
hide
)
Description:
tet program
Filename:
MIME Type:
Creator:
Ross Lagerwall
Created:
2015-07-26 15:56:05 UTC
Size:
2.35 KB
patch
obsolete
>#include <sys/types.h> >#include <stdio.h> >#include <unistd.h> >#include <string.h> >#include <time.h> >#include <errno.h> >#include <libsmbclient.h> >#include <inttypes.h> >#include <pthread.h> >#include <stdlib.h> > >static void >get_auth_data_fn(const char * pServer, > const char * pShare, > char * pWorkgroup, > int maxLenWorkgroup, > char * pUsername, > int maxLenUsername, > char * pPassword, > int maxLenPassword) >{ > strncpy(pWorkgroup, "WORKGROUP", maxLenWorkgroup); > strncpy(pUsername, "ross", maxLenUsername); > strncpy(pPassword, "password", maxLenPassword); >} > >static int notify_cb(const struct smbc_notify_callback_action *actions, > size_t num_actions, void *private_data) >{ > int *count = private_data; > size_t i; > > printf("%zu\n", num_actions); > > for (i=0; i<num_actions; i++) { > const struct smbc_notify_callback_action *a = &actions[i]; > printf("%s: %"PRIu32"\n", a->filename, a->action); > } > > *count -= 1; > if (*count < 0) { > return 1; > } > > return 0; >} > >static void * >thread_fn(void *unused) >{ > char path[2048] = "smb://192.168.1.48/Public"; > smbc_notify_fn smbc_notify; > smbc_opendir_fn smbc_opendir; > SMBCCTX *smb_context; > SMBCFILE *dir; > int count = 1000; > > smb_context = smbc_new_context (); > if (smb_context == NULL) > abort(); > smbc_setDebug (smb_context, 10); > smbc_setFunctionAuthData (smb_context, get_auth_data_fn); > if (!smbc_init_context (smb_context)) > abort(); > > smbc_opendir = smbc_getFunctionOpendir (smb_context); > dir = smbc_opendir (smb_context, path); > if (!dir) > return NULL; > > smbc_notify = smbc_getFunctionNotify (smb_context); > smbc_notify(smb_context, dir, 0, > SMBC_NOTIFY_CHANGE_FILE_NAME | > SMBC_NOTIFY_CHANGE_DIR_NAME | > SMBC_NOTIFY_CHANGE_ATTRIBUTES | > SMBC_NOTIFY_CHANGE_SIZE | > SMBC_NOTIFY_CHANGE_LAST_WRITE | > SMBC_NOTIFY_CHANGE_CREATION | > SMBC_NOTIFY_CHANGE_EA | > SMBC_NOTIFY_CHANGE_SECURITY, > 10000, notify_cb, &count); > return NULL; >} > >int main(int argc, char * argv[]) >{ > pthread_t thr[2]; > > pthread_create(&thr[0], NULL, thread_fn, NULL); > /*sleep (5);*/ > pthread_create(&thr[1], NULL, thread_fn, NULL); > pthread_join(thr[0], NULL); > > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 11413
: 11286 |
11303
|
11412