Fix unchecked calls to {m,c,re}alloc so that they print an error and
exit rather than segfaulting (what an improvement).
This commit is contained in:
		
							
								
								
									
										31
									
								
								lash.c
									
									
									
									
									
								
							
							
						
						
									
										31
									
								
								lash.c
									
									
									
									
									
								
							| @@ -787,8 +787,7 @@ static void globLastArgument(struct childProgram *prog, int *argcPtr, | |||||||
| 		*dst = '\0'; | 		*dst = '\0'; | ||||||
| 	} else if (!rc) { | 	} else if (!rc) { | ||||||
| 		argcAlloced += (prog->globResult.gl_pathc - i); | 		argcAlloced += (prog->globResult.gl_pathc - i); | ||||||
| 		prog->argv = | 		prog->argv = xrealloc(prog->argv, argcAlloced * sizeof(*prog->argv)); | ||||||
| 			realloc(prog->argv, argcAlloced * sizeof(*prog->argv)); |  | ||||||
| 		memcpy(prog->argv + (argc_l - 1), prog->globResult.gl_pathv + i, | 		memcpy(prog->argv + (argc_l - 1), prog->globResult.gl_pathv + i, | ||||||
| 			   sizeof(*(prog->argv)) * (prog->globResult.gl_pathc - i)); | 			   sizeof(*(prog->argv)) * (prog->globResult.gl_pathc - i)); | ||||||
| 		argc_l += (prog->globResult.gl_pathc - i - 1); | 		argc_l += (prog->globResult.gl_pathc - i - 1); | ||||||
| @@ -837,7 +836,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||||||
| 	   Getting clean memory relieves us of the task of NULL  | 	   Getting clean memory relieves us of the task of NULL  | ||||||
| 	   terminating things and makes the rest of this look a bit  | 	   terminating things and makes the rest of this look a bit  | ||||||
| 	   cleaner (though it is, admittedly, a tad less efficient) */ | 	   cleaner (though it is, admittedly, a tad less efficient) */ | ||||||
| 	job->cmdBuf = command = calloc(2*strlen(*commandPtr) + 1, sizeof(char)); | 	job->cmdBuf = command = xcalloc(2*strlen(*commandPtr) + 1, sizeof(char)); | ||||||
| 	job->text = NULL; | 	job->text = NULL; | ||||||
|  |  | ||||||
| 	prog = job->progs; | 	prog = job->progs; | ||||||
| @@ -876,9 +875,9 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||||||
| 				/* +1 here leaves room for the NULL which ends argv */ | 				/* +1 here leaves room for the NULL which ends argv */ | ||||||
| 				if ((argc_l + 1) == argvAlloced) { | 				if ((argc_l + 1) == argvAlloced) { | ||||||
| 					argvAlloced += 5; | 					argvAlloced += 5; | ||||||
| 					prog->argv = realloc(prog->argv, | 					prog->argv = xrealloc(prog->argv, | ||||||
| 										 sizeof(*prog->argv) * | 										  sizeof(*prog->argv) * | ||||||
| 										 argvAlloced); | 										  argvAlloced); | ||||||
| 				} | 				} | ||||||
| 				globLastArgument(prog, &argc_l, &argvAlloced); | 				globLastArgument(prog, &argc_l, &argvAlloced); | ||||||
| 				prog->argv[argc_l] = buf; | 				prog->argv[argc_l] = buf; | ||||||
| @@ -900,9 +899,9 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||||||
| 			case '>':			/* redirections */ | 			case '>':			/* redirections */ | ||||||
| 			case '<': | 			case '<': | ||||||
| 				i = prog->numRedirections++; | 				i = prog->numRedirections++; | ||||||
| 				prog->redirections = realloc(prog->redirections, | 				prog->redirections = xrealloc(prog->redirections, | ||||||
| 											 sizeof(*prog->redirections) * | 											  sizeof(*prog->redirections) * | ||||||
| 											 (i + 1)); | 											  (i + 1)); | ||||||
|  |  | ||||||
| 				prog->redirections[i].fd = -1; | 				prog->redirections[i].fd = -1; | ||||||
| 				if (buf != prog->argv[argc_l]) { | 				if (buf != prog->argv[argc_l]) { | ||||||
| @@ -969,8 +968,8 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||||||
|  |  | ||||||
| 				/* and start the next */ | 				/* and start the next */ | ||||||
| 				job->numProgs++; | 				job->numProgs++; | ||||||
| 				job->progs = realloc(job->progs, | 				job->progs = xrealloc(job->progs, | ||||||
| 									 sizeof(*job->progs) * job->numProgs); | 									  sizeof(*job->progs) * job->numProgs); | ||||||
| 				prog = job->progs + (job->numProgs - 1); | 				prog = job->progs + (job->numProgs - 1); | ||||||
| 				prog->numRedirections = 0; | 				prog->numRedirections = 0; | ||||||
| 				prog->redirections = NULL; | 				prog->redirections = NULL; | ||||||
| @@ -1058,7 +1057,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||||||
| 					while ( (size=fullRead(pipefd[0], charptr1, BUFSIZ-1)) >0) { | 					while ( (size=fullRead(pipefd[0], charptr1, BUFSIZ-1)) >0) { | ||||||
| 						int newSize=src - *commandPtr + size + 1 + strlen(charptr2); | 						int newSize=src - *commandPtr + size + 1 + strlen(charptr2); | ||||||
| 						if (newSize > BUFSIZ) { | 						if (newSize > BUFSIZ) { | ||||||
| 							*commandPtr=realloc(*commandPtr, src - *commandPtr +  | 							*commandPtr=xrealloc(*commandPtr, src - *commandPtr +  | ||||||
| 									size + 1 + strlen(charptr2)); | 									size + 1 + strlen(charptr2)); | ||||||
| 						} | 						} | ||||||
| 						memcpy(src, charptr1, size);  | 						memcpy(src, charptr1, size);  | ||||||
| @@ -1231,10 +1230,10 @@ static int runCommand(struct job *newJob, struct jobSet *jobList, int inBg, int | |||||||
|  |  | ||||||
| 	/* add the theJob to the list of running jobs */ | 	/* add the theJob to the list of running jobs */ | ||||||
| 	if (!jobList->head) { | 	if (!jobList->head) { | ||||||
| 		theJob = jobList->head = malloc(sizeof(*theJob)); | 		theJob = jobList->head = xmalloc(sizeof(*theJob)); | ||||||
| 	} else { | 	} else { | ||||||
| 		for (theJob = jobList->head; theJob->next; theJob = theJob->next); | 		for (theJob = jobList->head; theJob->next; theJob = theJob->next); | ||||||
| 		theJob->next = malloc(sizeof(*theJob)); | 		theJob->next = xmalloc(sizeof(*theJob)); | ||||||
| 		theJob = theJob->next; | 		theJob = theJob->next; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -1277,7 +1276,7 @@ static int busy_loop(FILE * input) | |||||||
| 	/* save current owner of TTY so we can restore it on exit */ | 	/* save current owner of TTY so we can restore it on exit */ | ||||||
| 	parent_pgrp = tcgetpgrp(0); | 	parent_pgrp = tcgetpgrp(0); | ||||||
|  |  | ||||||
| 	command = (char *) calloc(BUFSIZ, sizeof(char)); | 	command = (char *) xcalloc(BUFSIZ, sizeof(char)); | ||||||
|  |  | ||||||
| 	/* don't pay any attention to this signal; it just confuses  | 	/* don't pay any attention to this signal; it just confuses  | ||||||
| 	   things and isn't really meant for shells anyway */ | 	   things and isn't really meant for shells anyway */ | ||||||
| @@ -1303,7 +1302,7 @@ static int busy_loop(FILE * input) | |||||||
| 			} | 			} | ||||||
| 			else { | 			else { | ||||||
| 				free(command); | 				free(command); | ||||||
| 				command = (char *) calloc(BUFSIZ, sizeof(char)); | 				command = (char *) xcalloc(BUFSIZ, sizeof(char)); | ||||||
| 				nextCommand = NULL; | 				nextCommand = NULL; | ||||||
| 			} | 			} | ||||||
| 		} else { | 		} else { | ||||||
|   | |||||||
							
								
								
									
										31
									
								
								sh.c
									
									
									
									
									
								
							
							
						
						
									
										31
									
								
								sh.c
									
									
									
									
									
								
							| @@ -787,8 +787,7 @@ static void globLastArgument(struct childProgram *prog, int *argcPtr, | |||||||
| 		*dst = '\0'; | 		*dst = '\0'; | ||||||
| 	} else if (!rc) { | 	} else if (!rc) { | ||||||
| 		argcAlloced += (prog->globResult.gl_pathc - i); | 		argcAlloced += (prog->globResult.gl_pathc - i); | ||||||
| 		prog->argv = | 		prog->argv = xrealloc(prog->argv, argcAlloced * sizeof(*prog->argv)); | ||||||
| 			realloc(prog->argv, argcAlloced * sizeof(*prog->argv)); |  | ||||||
| 		memcpy(prog->argv + (argc_l - 1), prog->globResult.gl_pathv + i, | 		memcpy(prog->argv + (argc_l - 1), prog->globResult.gl_pathv + i, | ||||||
| 			   sizeof(*(prog->argv)) * (prog->globResult.gl_pathc - i)); | 			   sizeof(*(prog->argv)) * (prog->globResult.gl_pathc - i)); | ||||||
| 		argc_l += (prog->globResult.gl_pathc - i - 1); | 		argc_l += (prog->globResult.gl_pathc - i - 1); | ||||||
| @@ -837,7 +836,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||||||
| 	   Getting clean memory relieves us of the task of NULL  | 	   Getting clean memory relieves us of the task of NULL  | ||||||
| 	   terminating things and makes the rest of this look a bit  | 	   terminating things and makes the rest of this look a bit  | ||||||
| 	   cleaner (though it is, admittedly, a tad less efficient) */ | 	   cleaner (though it is, admittedly, a tad less efficient) */ | ||||||
| 	job->cmdBuf = command = calloc(2*strlen(*commandPtr) + 1, sizeof(char)); | 	job->cmdBuf = command = xcalloc(2*strlen(*commandPtr) + 1, sizeof(char)); | ||||||
| 	job->text = NULL; | 	job->text = NULL; | ||||||
|  |  | ||||||
| 	prog = job->progs; | 	prog = job->progs; | ||||||
| @@ -876,9 +875,9 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||||||
| 				/* +1 here leaves room for the NULL which ends argv */ | 				/* +1 here leaves room for the NULL which ends argv */ | ||||||
| 				if ((argc_l + 1) == argvAlloced) { | 				if ((argc_l + 1) == argvAlloced) { | ||||||
| 					argvAlloced += 5; | 					argvAlloced += 5; | ||||||
| 					prog->argv = realloc(prog->argv, | 					prog->argv = xrealloc(prog->argv, | ||||||
| 										 sizeof(*prog->argv) * | 										  sizeof(*prog->argv) * | ||||||
| 										 argvAlloced); | 										  argvAlloced); | ||||||
| 				} | 				} | ||||||
| 				globLastArgument(prog, &argc_l, &argvAlloced); | 				globLastArgument(prog, &argc_l, &argvAlloced); | ||||||
| 				prog->argv[argc_l] = buf; | 				prog->argv[argc_l] = buf; | ||||||
| @@ -900,9 +899,9 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||||||
| 			case '>':			/* redirections */ | 			case '>':			/* redirections */ | ||||||
| 			case '<': | 			case '<': | ||||||
| 				i = prog->numRedirections++; | 				i = prog->numRedirections++; | ||||||
| 				prog->redirections = realloc(prog->redirections, | 				prog->redirections = xrealloc(prog->redirections, | ||||||
| 											 sizeof(*prog->redirections) * | 											  sizeof(*prog->redirections) * | ||||||
| 											 (i + 1)); | 											  (i + 1)); | ||||||
|  |  | ||||||
| 				prog->redirections[i].fd = -1; | 				prog->redirections[i].fd = -1; | ||||||
| 				if (buf != prog->argv[argc_l]) { | 				if (buf != prog->argv[argc_l]) { | ||||||
| @@ -969,8 +968,8 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||||||
|  |  | ||||||
| 				/* and start the next */ | 				/* and start the next */ | ||||||
| 				job->numProgs++; | 				job->numProgs++; | ||||||
| 				job->progs = realloc(job->progs, | 				job->progs = xrealloc(job->progs, | ||||||
| 									 sizeof(*job->progs) * job->numProgs); | 									  sizeof(*job->progs) * job->numProgs); | ||||||
| 				prog = job->progs + (job->numProgs - 1); | 				prog = job->progs + (job->numProgs - 1); | ||||||
| 				prog->numRedirections = 0; | 				prog->numRedirections = 0; | ||||||
| 				prog->redirections = NULL; | 				prog->redirections = NULL; | ||||||
| @@ -1058,7 +1057,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||||||
| 					while ( (size=fullRead(pipefd[0], charptr1, BUFSIZ-1)) >0) { | 					while ( (size=fullRead(pipefd[0], charptr1, BUFSIZ-1)) >0) { | ||||||
| 						int newSize=src - *commandPtr + size + 1 + strlen(charptr2); | 						int newSize=src - *commandPtr + size + 1 + strlen(charptr2); | ||||||
| 						if (newSize > BUFSIZ) { | 						if (newSize > BUFSIZ) { | ||||||
| 							*commandPtr=realloc(*commandPtr, src - *commandPtr +  | 							*commandPtr=xrealloc(*commandPtr, src - *commandPtr +  | ||||||
| 									size + 1 + strlen(charptr2)); | 									size + 1 + strlen(charptr2)); | ||||||
| 						} | 						} | ||||||
| 						memcpy(src, charptr1, size);  | 						memcpy(src, charptr1, size);  | ||||||
| @@ -1231,10 +1230,10 @@ static int runCommand(struct job *newJob, struct jobSet *jobList, int inBg, int | |||||||
|  |  | ||||||
| 	/* add the theJob to the list of running jobs */ | 	/* add the theJob to the list of running jobs */ | ||||||
| 	if (!jobList->head) { | 	if (!jobList->head) { | ||||||
| 		theJob = jobList->head = malloc(sizeof(*theJob)); | 		theJob = jobList->head = xmalloc(sizeof(*theJob)); | ||||||
| 	} else { | 	} else { | ||||||
| 		for (theJob = jobList->head; theJob->next; theJob = theJob->next); | 		for (theJob = jobList->head; theJob->next; theJob = theJob->next); | ||||||
| 		theJob->next = malloc(sizeof(*theJob)); | 		theJob->next = xmalloc(sizeof(*theJob)); | ||||||
| 		theJob = theJob->next; | 		theJob = theJob->next; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -1277,7 +1276,7 @@ static int busy_loop(FILE * input) | |||||||
| 	/* save current owner of TTY so we can restore it on exit */ | 	/* save current owner of TTY so we can restore it on exit */ | ||||||
| 	parent_pgrp = tcgetpgrp(0); | 	parent_pgrp = tcgetpgrp(0); | ||||||
|  |  | ||||||
| 	command = (char *) calloc(BUFSIZ, sizeof(char)); | 	command = (char *) xcalloc(BUFSIZ, sizeof(char)); | ||||||
|  |  | ||||||
| 	/* don't pay any attention to this signal; it just confuses  | 	/* don't pay any attention to this signal; it just confuses  | ||||||
| 	   things and isn't really meant for shells anyway */ | 	   things and isn't really meant for shells anyway */ | ||||||
| @@ -1303,7 +1302,7 @@ static int busy_loop(FILE * input) | |||||||
| 			} | 			} | ||||||
| 			else { | 			else { | ||||||
| 				free(command); | 				free(command); | ||||||
| 				command = (char *) calloc(BUFSIZ, sizeof(char)); | 				command = (char *) xcalloc(BUFSIZ, sizeof(char)); | ||||||
| 				nextCommand = NULL; | 				nextCommand = NULL; | ||||||
| 			} | 			} | ||||||
| 		} else { | 		} else { | ||||||
|   | |||||||
							
								
								
									
										31
									
								
								shell/lash.c
									
									
									
									
									
								
							
							
						
						
									
										31
									
								
								shell/lash.c
									
									
									
									
									
								
							| @@ -787,8 +787,7 @@ static void globLastArgument(struct childProgram *prog, int *argcPtr, | |||||||
| 		*dst = '\0'; | 		*dst = '\0'; | ||||||
| 	} else if (!rc) { | 	} else if (!rc) { | ||||||
| 		argcAlloced += (prog->globResult.gl_pathc - i); | 		argcAlloced += (prog->globResult.gl_pathc - i); | ||||||
| 		prog->argv = | 		prog->argv = xrealloc(prog->argv, argcAlloced * sizeof(*prog->argv)); | ||||||
| 			realloc(prog->argv, argcAlloced * sizeof(*prog->argv)); |  | ||||||
| 		memcpy(prog->argv + (argc_l - 1), prog->globResult.gl_pathv + i, | 		memcpy(prog->argv + (argc_l - 1), prog->globResult.gl_pathv + i, | ||||||
| 			   sizeof(*(prog->argv)) * (prog->globResult.gl_pathc - i)); | 			   sizeof(*(prog->argv)) * (prog->globResult.gl_pathc - i)); | ||||||
| 		argc_l += (prog->globResult.gl_pathc - i - 1); | 		argc_l += (prog->globResult.gl_pathc - i - 1); | ||||||
| @@ -837,7 +836,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||||||
| 	   Getting clean memory relieves us of the task of NULL  | 	   Getting clean memory relieves us of the task of NULL  | ||||||
| 	   terminating things and makes the rest of this look a bit  | 	   terminating things and makes the rest of this look a bit  | ||||||
| 	   cleaner (though it is, admittedly, a tad less efficient) */ | 	   cleaner (though it is, admittedly, a tad less efficient) */ | ||||||
| 	job->cmdBuf = command = calloc(2*strlen(*commandPtr) + 1, sizeof(char)); | 	job->cmdBuf = command = xcalloc(2*strlen(*commandPtr) + 1, sizeof(char)); | ||||||
| 	job->text = NULL; | 	job->text = NULL; | ||||||
|  |  | ||||||
| 	prog = job->progs; | 	prog = job->progs; | ||||||
| @@ -876,9 +875,9 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||||||
| 				/* +1 here leaves room for the NULL which ends argv */ | 				/* +1 here leaves room for the NULL which ends argv */ | ||||||
| 				if ((argc_l + 1) == argvAlloced) { | 				if ((argc_l + 1) == argvAlloced) { | ||||||
| 					argvAlloced += 5; | 					argvAlloced += 5; | ||||||
| 					prog->argv = realloc(prog->argv, | 					prog->argv = xrealloc(prog->argv, | ||||||
| 										 sizeof(*prog->argv) * | 										  sizeof(*prog->argv) * | ||||||
| 										 argvAlloced); | 										  argvAlloced); | ||||||
| 				} | 				} | ||||||
| 				globLastArgument(prog, &argc_l, &argvAlloced); | 				globLastArgument(prog, &argc_l, &argvAlloced); | ||||||
| 				prog->argv[argc_l] = buf; | 				prog->argv[argc_l] = buf; | ||||||
| @@ -900,9 +899,9 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||||||
| 			case '>':			/* redirections */ | 			case '>':			/* redirections */ | ||||||
| 			case '<': | 			case '<': | ||||||
| 				i = prog->numRedirections++; | 				i = prog->numRedirections++; | ||||||
| 				prog->redirections = realloc(prog->redirections, | 				prog->redirections = xrealloc(prog->redirections, | ||||||
| 											 sizeof(*prog->redirections) * | 											  sizeof(*prog->redirections) * | ||||||
| 											 (i + 1)); | 											  (i + 1)); | ||||||
|  |  | ||||||
| 				prog->redirections[i].fd = -1; | 				prog->redirections[i].fd = -1; | ||||||
| 				if (buf != prog->argv[argc_l]) { | 				if (buf != prog->argv[argc_l]) { | ||||||
| @@ -969,8 +968,8 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||||||
|  |  | ||||||
| 				/* and start the next */ | 				/* and start the next */ | ||||||
| 				job->numProgs++; | 				job->numProgs++; | ||||||
| 				job->progs = realloc(job->progs, | 				job->progs = xrealloc(job->progs, | ||||||
| 									 sizeof(*job->progs) * job->numProgs); | 									  sizeof(*job->progs) * job->numProgs); | ||||||
| 				prog = job->progs + (job->numProgs - 1); | 				prog = job->progs + (job->numProgs - 1); | ||||||
| 				prog->numRedirections = 0; | 				prog->numRedirections = 0; | ||||||
| 				prog->redirections = NULL; | 				prog->redirections = NULL; | ||||||
| @@ -1058,7 +1057,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||||||
| 					while ( (size=fullRead(pipefd[0], charptr1, BUFSIZ-1)) >0) { | 					while ( (size=fullRead(pipefd[0], charptr1, BUFSIZ-1)) >0) { | ||||||
| 						int newSize=src - *commandPtr + size + 1 + strlen(charptr2); | 						int newSize=src - *commandPtr + size + 1 + strlen(charptr2); | ||||||
| 						if (newSize > BUFSIZ) { | 						if (newSize > BUFSIZ) { | ||||||
| 							*commandPtr=realloc(*commandPtr, src - *commandPtr +  | 							*commandPtr=xrealloc(*commandPtr, src - *commandPtr +  | ||||||
| 									size + 1 + strlen(charptr2)); | 									size + 1 + strlen(charptr2)); | ||||||
| 						} | 						} | ||||||
| 						memcpy(src, charptr1, size);  | 						memcpy(src, charptr1, size);  | ||||||
| @@ -1231,10 +1230,10 @@ static int runCommand(struct job *newJob, struct jobSet *jobList, int inBg, int | |||||||
|  |  | ||||||
| 	/* add the theJob to the list of running jobs */ | 	/* add the theJob to the list of running jobs */ | ||||||
| 	if (!jobList->head) { | 	if (!jobList->head) { | ||||||
| 		theJob = jobList->head = malloc(sizeof(*theJob)); | 		theJob = jobList->head = xmalloc(sizeof(*theJob)); | ||||||
| 	} else { | 	} else { | ||||||
| 		for (theJob = jobList->head; theJob->next; theJob = theJob->next); | 		for (theJob = jobList->head; theJob->next; theJob = theJob->next); | ||||||
| 		theJob->next = malloc(sizeof(*theJob)); | 		theJob->next = xmalloc(sizeof(*theJob)); | ||||||
| 		theJob = theJob->next; | 		theJob = theJob->next; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -1277,7 +1276,7 @@ static int busy_loop(FILE * input) | |||||||
| 	/* save current owner of TTY so we can restore it on exit */ | 	/* save current owner of TTY so we can restore it on exit */ | ||||||
| 	parent_pgrp = tcgetpgrp(0); | 	parent_pgrp = tcgetpgrp(0); | ||||||
|  |  | ||||||
| 	command = (char *) calloc(BUFSIZ, sizeof(char)); | 	command = (char *) xcalloc(BUFSIZ, sizeof(char)); | ||||||
|  |  | ||||||
| 	/* don't pay any attention to this signal; it just confuses  | 	/* don't pay any attention to this signal; it just confuses  | ||||||
| 	   things and isn't really meant for shells anyway */ | 	   things and isn't really meant for shells anyway */ | ||||||
| @@ -1303,7 +1302,7 @@ static int busy_loop(FILE * input) | |||||||
| 			} | 			} | ||||||
| 			else { | 			else { | ||||||
| 				free(command); | 				free(command); | ||||||
| 				command = (char *) calloc(BUFSIZ, sizeof(char)); | 				command = (char *) xcalloc(BUFSIZ, sizeof(char)); | ||||||
| 				nextCommand = NULL; | 				nextCommand = NULL; | ||||||
| 			} | 			} | ||||||
| 		} else { | 		} else { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user