Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   ArchLinux Pacman Development (http://www.linux-archive.org/archlinux-pacman-development/)
-   -   Only read from stdin if sole target is '-' (http://www.linux-archive.org/archlinux-pacman-development/502025-only-read-stdin-if-sole-target.html)

Dave Reisner 03-16-2011 08:24 PM

Only read from stdin if sole target is '-'
 
This prevents a regression for people who enjoy piping yes to pacman to
avoid prompts.

Signed-off-by: Dave Reisner <d@falconindy.com>
---
src/pacman/pacman.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 984bd1b..c66d34b 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -1361,8 +1361,9 @@ 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 the only arg is '-' */
+ if(!isatty(fileno(stdin) && alpm_list_count(pm_targets) == 1 &&
+ strcmp(alpm_list_getdata(pm_targets), "-") == 0)) {
char line[PATH_MAX];
int i = 0;
while(i < PATH_MAX && (line[i] = (char)fgetc(stdin)) != EOF) {
--
1.7.4.1


All times are GMT. The time now is 03:17 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.