aboutsummaryrefslogtreecommitdiff
path: root/sh.c
diff options
context:
space:
mode:
Diffstat (limited to 'sh.c')
-rw-r--r--sh.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/sh.c b/sh.c
index 9fc215c98..164d6f5c5 100644
--- a/sh.c
+++ b/sh.c
@@ -663,7 +663,7 @@ static int setupRedirections(struct childProgram *prog)
663 663
664static int getCommand(FILE * source, char *command) 664static int getCommand(FILE * source, char *command)
665{ 665{
666 char *user,buf[255],*s; 666 char user[9],buf[255],*s;
667 667
668 if (source == NULL) { 668 if (source == NULL) {
669 if (local_pending_command) { 669 if (local_pending_command) {
@@ -678,7 +678,6 @@ static int getCommand(FILE * source, char *command)
678 678
679 /* get User Name and setup prompt */ 679 /* get User Name and setup prompt */
680 strcpy(prompt,( geteuid() != 0 ) ? "$ ":"# "); 680 strcpy(prompt,( geteuid() != 0 ) ? "$ ":"# ");
681 user=xcalloc(sizeof(int), 9);
682 my_getpwuid(user, geteuid()); 681 my_getpwuid(user, geteuid());
683 682
684 /* get HostName */ 683 /* get HostName */
@@ -723,9 +722,6 @@ static int getCommand(FILE * source, char *command)
723#endif 722#endif
724 } 723 }
725 724
726 /* don't leak memory */
727 free(user);
728
729 if (!fgets(command, BUFSIZ - 2, source)) { 725 if (!fgets(command, BUFSIZ - 2, source)) {
730 if (source == stdin) 726 if (source == stdin)
731 printf("\n"); 727 printf("\n");