svn commit: samba r25482 - in branches: SAMBA_3_2/source/rpc_server
SAMBA_3_2_0/source/rpc_server
vlendec at samba.org
vlendec at samba.org
Wed Oct 3 13:13:02 GMT 2007
Author: vlendec
Date: 2007-10-03 13:13:02 +0000 (Wed, 03 Oct 2007)
New Revision: 25482
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25482
Log:
Slightly simplify logic
Instead of one big if-branch for if (process_exists(..)) return if
(!process_exists(..))
Modified:
branches/SAMBA_3_2/source/rpc_server/srv_srvsvc_nt.c
branches/SAMBA_3_2_0/source/rpc_server/srv_srvsvc_nt.c
Changeset:
Modified: branches/SAMBA_3_2/source/rpc_server/srv_srvsvc_nt.c
===================================================================
--- branches/SAMBA_3_2/source/rpc_server/srv_srvsvc_nt.c 2007-10-03 12:55:45 UTC (rev 25481)
+++ branches/SAMBA_3_2/source/rpc_server/srv_srvsvc_nt.c 2007-10-03 13:13:02 UTC (rev 25482)
@@ -129,64 +129,64 @@
{
struct file_enum_count *fenum =
(struct file_enum_count *)private_data;
+
+ struct srvsvc_NetFileInfo3 *f;
+ int i = fenum->count;
+ files_struct fsp;
+ struct byte_range_lock *brl;
+ int num_locks = 0;
+ pstring fullpath;
+ uint32 permissions;
/* If the pid was not found delete the entry from connections.tdb */
- if ( process_exists(e->pid) ) {
- struct srvsvc_NetFileInfo3 *f;
- int i = fenum->count;
- files_struct fsp;
- struct byte_range_lock *brl;
- int num_locks = 0;
- pstring fullpath;
- uint32 permissions;
+ if (!process_exists(e->pid)) {
+ return;
+ }
- f = TALLOC_REALLOC_ARRAY( fenum->ctx, fenum->info, struct srvsvc_NetFileInfo3, i+1 );
- if ( !f ) {
- DEBUG(0,("conn_enum_fn: realloc failed for %d items\n", i+1));
- return;
- }
- fenum->info = f;
+ f = TALLOC_REALLOC_ARRAY( fenum->ctx, fenum->info,
+ struct srvsvc_NetFileInfo3, i+1 );
+ if ( !f ) {
+ DEBUG(0,("conn_enum_fn: realloc failed for %d items\n", i+1));
+ return;
+ }
+ fenum->info = f;
- /* need to count the number of locks on a file */
+ /* need to count the number of locks on a file */
- ZERO_STRUCT( fsp );
- fsp.file_id = e->id;
+ ZERO_STRUCT( fsp );
+ fsp.file_id = e->id;
- if ( (brl = brl_get_locks_readonly(NULL,&fsp)) != NULL ) {
- num_locks = brl->num_locks;
- TALLOC_FREE( brl );
- }
+ if ( (brl = brl_get_locks_readonly(NULL,&fsp)) != NULL ) {
+ num_locks = brl->num_locks;
+ TALLOC_FREE( brl );
+ }
- if ( strcmp( fname, "." ) == 0 ) {
- pstr_sprintf( fullpath, "C:%s", sharepath );
- } else {
- pstr_sprintf( fullpath, "C:%s/%s", sharepath, fname );
- }
- string_replace( fullpath, '/', '\\' );
+ if ( strcmp( fname, "." ) == 0 ) {
+ pstr_sprintf( fullpath, "C:%s", sharepath );
+ } else {
+ pstr_sprintf( fullpath, "C:%s/%s", sharepath, fname );
+ }
+ string_replace( fullpath, '/', '\\' );
- /* mask out create (what ever that is) */
- permissions = e->share_access & (FILE_READ_DATA|FILE_WRITE_DATA);
+ /* mask out create (what ever that is) */
+ permissions = e->share_access & (FILE_READ_DATA|FILE_WRITE_DATA);
- fenum->info[i].fid = e->share_file_id;
- fenum->info[i].permissions = permissions;
- fenum->info[i].num_locks = num_locks;
- if (!(fenum->info[i].user = talloc_strdup(
- fenum->ctx, uidtoname(e->uid)))) {
- /* There's not much we can do here. */
- fenum->info[i].user = "";
- }
- if (!(fenum->info[i].path = talloc_strdup(
- fenum->ctx, fullpath))) {
- /* There's not much we can do here. */
- fenum->info[i].path = "";
- }
+ fenum->info[i].fid = e->share_file_id;
+ fenum->info[i].permissions = permissions;
+ fenum->info[i].num_locks = num_locks;
+ if (!(fenum->info[i].user = talloc_strdup(
+ fenum->ctx, uidtoname(e->uid)))) {
+ /* There's not much we can do here. */
+ fenum->info[i].user = "";
+ }
+ if (!(fenum->info[i].path = talloc_strdup(
+ fenum->ctx, fullpath))) {
+ /* There's not much we can do here. */
+ fenum->info[i].path = "";
+ }
- fenum->count++;
- }
-
- return;
-
+ fenum->count++;
}
/*******************************************************************
Modified: branches/SAMBA_3_2_0/source/rpc_server/srv_srvsvc_nt.c
===================================================================
--- branches/SAMBA_3_2_0/source/rpc_server/srv_srvsvc_nt.c 2007-10-03 12:55:45 UTC (rev 25481)
+++ branches/SAMBA_3_2_0/source/rpc_server/srv_srvsvc_nt.c 2007-10-03 13:13:02 UTC (rev 25482)
@@ -118,58 +118,57 @@
{
struct file_enum_count *fenum =
(struct file_enum_count *)private_data;
+
+ FILE_INFO_3 *f;
+ int i = fenum->count;
+ files_struct fsp;
+ struct byte_range_lock *brl;
+ int num_locks = 0;
+ pstring fullpath;
+ uint32 permissions;
/* If the pid was not found delete the entry from connections.tdb */
- if ( process_exists(e->pid) ) {
- FILE_INFO_3 *f;
- int i = fenum->count;
- files_struct fsp;
- struct byte_range_lock *brl;
- int num_locks = 0;
- pstring fullpath;
- uint32 permissions;
+ if ( !process_exists(e->pid) ) {
+ return;
+ }
- f = TALLOC_REALLOC_ARRAY( fenum->ctx, fenum->info, FILE_INFO_3, i+1 );
- if ( !f ) {
- DEBUG(0,("conn_enum_fn: realloc failed for %d items\n", i+1));
- return;
- }
- fenum->info = f;
+ f = TALLOC_REALLOC_ARRAY( fenum->ctx, fenum->info, FILE_INFO_3, i+1 );
+ if ( !f ) {
+ DEBUG(0,("conn_enum_fn: realloc failed for %d items\n", i+1));
+ return;
+ }
+ fenum->info = f;
- /* need to count the number of locks on a file */
+ /* need to count the number of locks on a file */
- ZERO_STRUCT( fsp );
- fsp.file_id = e->id;
+ ZERO_STRUCT( fsp );
+ fsp.file_id = e->id;
- if ( (brl = brl_get_locks(NULL,&fsp)) != NULL ) {
- num_locks = brl->num_locks;
- TALLOC_FREE( brl );
- }
+ if ( (brl = brl_get_locks(NULL,&fsp)) != NULL ) {
+ num_locks = brl->num_locks;
+ TALLOC_FREE( brl );
+ }
- if ( strcmp( fname, "." ) == 0 ) {
- pstr_sprintf( fullpath, "C:%s", sharepath );
- } else {
- pstr_sprintf( fullpath, "C:%s/%s", sharepath, fname );
- }
- string_replace( fullpath, '/', '\\' );
+ if ( strcmp( fname, "." ) == 0 ) {
+ pstr_sprintf( fullpath, "C:%s", sharepath );
+ } else {
+ pstr_sprintf( fullpath, "C:%s/%s", sharepath, fname );
+ }
+ string_replace( fullpath, '/', '\\' );
- /* mask out create (what ever that is) */
- permissions = e->share_access & (FILE_READ_DATA|FILE_WRITE_DATA);
+ /* mask out create (what ever that is) */
+ permissions = e->share_access & (FILE_READ_DATA|FILE_WRITE_DATA);
- /* now fill in the FILE_INFO_3 struct */
- init_srv_file_info3( &fenum->info[i],
- e->share_file_id,
- permissions,
- num_locks,
- uidtoname(e->uid),
- fullpath );
+ /* now fill in the FILE_INFO_3 struct */
+ init_srv_file_info3( &fenum->info[i],
+ e->share_file_id,
+ permissions,
+ num_locks,
+ uidtoname(e->uid),
+ fullpath );
- fenum->count++;
- }
-
- return;
-
+ fenum->count++;
}
/*******************************************************************
More information about the samba-cvs
mailing list