summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2007-10-03 13:13:02 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:31:07 -0500
commit105d2a67eadc009031ebc163a5cf30594303806f (patch)
treec5af29bbac2e0f5d63b8b0477158d644a5a4e499 /source3/rpc_server
parent4a952fb0c0bb9d8ebb733b32f3f16596293b320b (diff)
downloadsamba-105d2a67eadc009031ebc163a5cf30594303806f.tar.gz
samba-105d2a67eadc009031ebc163a5cf30594303806f.tar.bz2
samba-105d2a67eadc009031ebc163a5cf30594303806f.zip
r25482: Slightly simplify logic
Instead of one big if-branch for if (process_exists(..)) return if (!process_exists(..)) (This used to be commit 3acc00132c97b36e026162ae11a23953269dfbed)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_srvsvc_nt.c96
1 files changed, 48 insertions, 48 deletions
diff --git a/source3/rpc_server/srv_srvsvc_nt.c b/source3/rpc_server/srv_srvsvc_nt.c
index d89fe65274..cc0968a544 100644
--- a/source3/rpc_server/srv_srvsvc_nt.c
+++ b/source3/rpc_server/srv_srvsvc_nt.c
@@ -129,64 +129,64 @@ static void enum_file_fn( const struct share_mode_entry *e,
{
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);
-
- 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++;
+ /* 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 = "";
}
-
- return;
-
+
+ fenum->count++;
}
/*******************************************************************