[BusyBox] fix sh memory leak
Gennady Feldman
gfeldman at mail.com
Thu Dec 14 19:35:14 UTC 2000
Hello Erik.
First of all congrats on the release. Second here is some small cleanup of the
code which is not longer necessary. Addresses the prompt (get_last_path_component)
code.
G.F.
-------------- next part --------------
Index: sh.c
===================================================================
RCS file: /var/cvs/busybox/sh.c,v
retrieving revision 1.62
diff -u -r1.62 sh.c
--- sh.c 2000/12/12 23:45:36 1.62
+++ sh.c 2000/12/14 19:31:45
@@ -710,14 +710,8 @@
signal(SIGWINCH, SIG_DFL);
return 0;
#else
- i=strlen(cwd);
- i--;
- if (i>1){
- while ((i>0) && (*(cwd+i)!='/') ) i--;
- if (*(cwd+i)=='/') i++;
- }
-
- fprintf(stdout, "[%s@%s %s]%s",user, buf, (cwd+i), prompt);
+ fprintf(stdout, "[%s@%s %s]%s",user, buf,
+ get_last_path_component(cwd), prompt);
fflush(stdout);
#endif
}
More information about the busybox
mailing list