diff options
author | Dave Reisner <d@falconindy.com> | 2011-03-16 22:23:00 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-03-17 01:52:54 +0100 |
commit | 40a6c5c5eca05b5f65b1dc0c6d5c87fcd313fb2e (patch) | |
tree | 39a98612407f36e75f23ea88746654031ba44d88 | |
parent | deed0286ef7045ce54fc54f8cadebfe3ebb5f725 (diff) | |
download | pacman-40a6c5c5eca05b5f65b1dc0c6d5c87fcd313fb2e.tar.gz pacman-40a6c5c5eca05b5f65b1dc0c6d5c87fcd313fb2e.tar.xz |
Only read from stdin if '-' is provided as a target
This prevents a regression for people who enjoy piping yes to pacman to
avoid prompts.
Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r-- | src/pacman/pacman.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 984bd1b7..073a0175 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -1361,10 +1361,14 @@ int main(int argc, char *argv[]) cleanup(ret); } - /* we also support reading targets from stdin */ - if(!isatty(fileno(stdin))) { + /* we support reading targets from stdin if a cmdline parameter is '-' */ + if(!isatty(fileno(stdin)) && alpm_list_find_str(pm_targets, "-")) { char line[PATH_MAX]; int i = 0; + + /* remove the '-' from the list */ + pm_targets = alpm_list_remove_str(pm_targets, "-", NULL); + while(i < PATH_MAX && (line[i] = (char)fgetc(stdin)) != EOF) { if(isspace((unsigned char)line[i])) { /* avoid adding zero length arg when multiple spaces separate args */ |