From 49e6c777dd3bd6d35a24be08345c54c4a8d454f4 Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Sun, 1 Jun 1997 03:15:07 +0000 Subject: [PATCH] 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 --- appl/ftp/ftpd/popen.c | 4 +++- lib/sl/sl.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/appl/ftp/ftpd/popen.c b/appl/ftp/ftpd/popen.c index 1f226453d..ffc41f211 100644 --- a/appl/ftp/ftpd/popen.c +++ b/appl/ftp/ftpd/popen.c @@ -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 */ diff --git a/lib/sl/sl.c b/lib/sl/sl.c index bcd0afd6e..940fbeb32 100644 --- a/lib/sl/sl.c +++ b/lib/sl/sl.c @@ -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);