Initialize the `lasts' to NULL before calling strtok_r the first time.
With our strtok_r it's not necessary, but the man-page on SGIs says it should be done. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1791 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -125,9 +125,11 @@ ftpd_popen(char *program, char *type, int do_stderr, int no_glob)
|
||||
return (NULL);
|
||||
|
||||
/* break up string into pieces */
|
||||
for (argc = 0, cp = program;; cp = NULL)
|
||||
for (argc = 0, cp = program;; cp = NULL) {
|
||||
foo = NULL;
|
||||
if (!(argv[argc++] = strtok_r(cp, " \t\n", &foo)))
|
||||
break;
|
||||
}
|
||||
|
||||
gargv[0] = (char*)ftp_rooted(argv[0]);
|
||||
/* glob each piece */
|
||||
|
@@ -157,7 +157,7 @@ sl_loop (SL_cmd *cmds, char *prompt)
|
||||
add_history(buf);
|
||||
count = 0;
|
||||
{
|
||||
char *foo;
|
||||
char *foo = NULL;
|
||||
char *p;
|
||||
|
||||
for(p = strtok_r (buf, " \t", &foo);
|
||||
|
Reference in New Issue
Block a user