query about rpcclient process_cmd:

Herb Lewis herb at sgi.com
Thu Feb 13 18:24:57 GMT 2003


"Gerald (Jerry) Carter" wrote:
> On Thu, 13 Feb 2003, Martin Pool wrote:
> 
> > rpcclient.c/process_cmd has
> >
> >         if (cmd[strlen(cmd) - 1] == '\n')
> >                 cmd[strlen(cmd) - 1] = '\0';
> >
> >         if (!next_token(&p, buf, " ", sizeof(buf))) {
> >                 return NT_STATUS_OK;
> >         }
> >
> >         /* strip the trainly \n if it exsists */
> >         len = strlen(buf);
> >         if (buf[len-1] == '\n')
> >                 buf[len-1] = '\0';
> >
> > Isn't the second check for newline redundant?
> 
> Looks like it to me.
> 

Only redundant if we can guarentee that the cmd string will only have
one \n at the end and no other ones embeded in the string. I don't
know enough about rpcclient to know if this is true.

-- 
======================================================================
Herb Lewis                               Silicon Graphics 
Networking Engineer                      1600 Amphitheatre Pkwy MS-510
Strategic Software Organization          Mountain View, CA  94043-1351
herb at sgi.com                             Tel: 650-933-2177
http://www.sgi.com                       Fax: 650-932-2177          
PGP Key: 0x8408D65D
======================================================================


More information about the samba-technical mailing list