diff --git a/yeeshell.c b/yeeshell.c index c0b45cb..2abac20 100644 --- a/yeeshell.c +++ b/yeeshell.c @@ -157,7 +157,7 @@ int check_redirect(char **args, char *redirect_filename, char **redirect_args) if (redirect_flag == 1) /* redirect output */ { - redirect_filename = args[i + 1]; + strcpy(redirect_filename, rgs[i + 1]); for (j = 0; j < i; j++) { redirect_args[i] = args[i]; @@ -179,7 +179,8 @@ int execute(char *cmdline, char **args) { int bg = 0, i = 0, redirect_flag = 0; pid_t pid; - char *redirect_filename; + char *redirect_filename = NULL; + redirect_filename = (char *)calloc(32, sizeof(char)); char *redirect_args[ARGS_MAX_QUANTITY]; sigset_t mask_all, mask_prev; sigprocmask(SIG_BLOCK, NULL, &mask_all);