diff options
Diffstat (limited to 'source3/libsmb/clilist.c')
-rw-r--r-- | source3/libsmb/clilist.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/source3/libsmb/clilist.c b/source3/libsmb/clilist.c index 18c058f9df..22cb5930c2 100644 --- a/source3/libsmb/clilist.c +++ b/source3/libsmb/clilist.c @@ -349,10 +349,17 @@ int cli_list_new(struct cli_state *cli,const char *Mask,uint16 attribute, mnt = cli_cm_get_mntpoint( cli ); - for (p=dirlist,i=0;i<total_received;i++) { - p += interpret_long_filename(cli,info_level,p,&finfo,NULL,NULL,NULL); - fn( mnt,&finfo, Mask, state ); - } + /* see if the server disconnected or the connection otherwise failed */ + if (cli_is_error(cli)) { + total_received = -1; + } else { + /* no connection problem. let user function add each entry */ + for (p=dirlist,i=0;i<total_received;i++) { + p += interpret_long_filename(cli, info_level, p, + &finfo,NULL,NULL,NULL); + fn( mnt,&finfo, Mask, state ); + } + } /* free up the dirlist buffer and last name raw blob */ SAFE_FREE(dirlist); |