index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Andrew Gregory <andrew.gregory.8@gmail.com> | 2013-06-02 23:45:05 -0400 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2013-06-06 13:47:32 +1000 |
commit | ab3d8478c23dd3f256da89c2a2a27f8a7f3d3893 (patch) | |
tree | 1a857dee80c7d50029eec41acf2a8d8fe92bfe74 /src | |
parent | 9574bfd6c873d70e29a5003461b2d691f134c8ab (diff) |
-rw-r--r-- | src/pacman/pacman.c | 8 |
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 921331c6..7aa0271c 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -826,6 +826,7 @@ int main(int argc, char *argv[]) /* we support reading targets from stdin if a cmdline parameter is '-' */ if(alpm_list_find_str(pm_targets, "-")) { if(!isatty(fileno(stdin))) { + int target_found = 0; size_t current_size = PATH_MAX; char *vdata, *line = malloc(current_size); @@ -840,6 +841,7 @@ int main(int argc, char *argv[]) if(i > 0) { line[i] = '\0'; pm_targets = alpm_list_add(pm_targets, strdup(line)); + target_found = 1; i = 0; } } else { @@ -869,12 +871,18 @@ int main(int argc, char *argv[]) if(i > 0) { line[i] = '\0'; pm_targets = alpm_list_add(pm_targets, strdup(line)); + target_found = 1; } free(line); if(!freopen(ctermid(NULL), "r", stdin)) { pm_printf(ALPM_LOG_ERROR, _("failed to reopen stdin for reading: (%s)\n"), strerror(errno)); } + + if(!target_found) { + pm_printf(ALPM_LOG_ERROR, _("argument '-' specified with empty stdin\n")); + cleanup(1); + } } else { /* do not read stdin from terminal */ pm_printf(ALPM_LOG_ERROR, _("argument '-' specified without input on stdin\n")); |