Better error message with "-" is specified without stdin
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
5c5cdb0eb9
commit
7956441350
|
@ -809,7 +809,8 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
/* we support reading targets from stdin if a cmdline parameter is '-' */
|
||||
if(!isatty(fileno(stdin)) && alpm_list_find_str(pm_targets, "-")) {
|
||||
if(alpm_list_find_str(pm_targets, "-")) {
|
||||
if(!isatty(fileno(stdin))) {
|
||||
size_t current_size = PATH_MAX;
|
||||
char *vdata, *line = malloc(current_size);
|
||||
|
||||
|
@ -842,6 +843,7 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* check for memory exhaustion */
|
||||
if(!line) {
|
||||
pm_printf(ALPM_LOG_ERROR, _("memory exhausted in argument parsing\n"));
|
||||
|
@ -858,6 +860,11 @@ int main(int argc, char *argv[])
|
|||
pm_printf(ALPM_LOG_ERROR, _("failed to reopen stdin for reading: (%s)\n"),
|
||||
strerror(errno));
|
||||
}
|
||||
} else {
|
||||
/* do not read stdin from terminal */
|
||||
pm_printf(ALPM_LOG_ERROR, _("argument '-' specified without input on stdin\n"));
|
||||
cleanup(1);
|
||||
}
|
||||
}
|
||||
|
||||
/* parse the config file */
|
||||
|
|
Loading…
Reference in New Issue