[Pkg-voip-commits] [sngrep] 01/02: debian/patches: fix_stdin.patch

Victor Seva vseva at moszumanska.debian.org
Wed Oct 4 11:06:10 UTC 2017


This is an automated email from the git hooks/post-receive script.

vseva pushed a commit to branch master
in repository sngrep.

commit 7b86bdfa7785685d9ceee7ba2436f51918aeda20
Author: Victor Seva <linuxmaniac at torreviejawireless.org>
Date:   Mon Oct 2 17:39:47 2017 +0200

    debian/patches: fix_stdin.patch
    
    tests were failing
---
 debian/patches/fix_stdin.patch | 53 ++++++++++++++++++++++++++++++++++++++++++
 debian/patches/series          |  1 +
 2 files changed, 54 insertions(+)

diff --git a/debian/patches/fix_stdin.patch b/debian/patches/fix_stdin.patch
new file mode 100644
index 0000000..bb3547c
--- /dev/null
+++ b/debian/patches/fix_stdin.patch
@@ -0,0 +1,53 @@
+From 2d4eee8015606e5052b559b15a96a0d6a7b69864 Mon Sep 17 00:00:00 2001
+From: Kaian <kaian at irontec.com>
+Date: Mon, 2 Oct 2017 15:20:11 +0200
+Subject: [PATCH] capture: only read stdin when input file is -
+
+stdin was being reopened always even when input file was a pcap file.
+
+Current tests enter keybinding from stdin so its data was being
+ignored making them fail.
+---
+ src/capture.c           | 2 ++
+ src/curses/ui_manager.c | 4 ----
+ 2 files changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/src/capture.c b/src/capture.c
+index c67c374..59e5dd4 100644
+--- a/src/capture.c
++++ b/src/capture.c
+@@ -159,6 +159,7 @@ int
+ capture_offline(const char *infile, const char *outfile)
+ {
+     capture_info_t *capinfo;
++    FILE *fstdin;
+ 
+     // Error text (in case of file open error)
+     char errbuf[PCAP_ERRBUF_SIZE];
+@@ -172,6 +173,7 @@ capture_offline(const char *infile, const char *outfile)
+     // Check if file is standard input
+     if (strlen(infile) == 1 && *infile == '-') {
+         infile = "/dev/stdin";
++        fstdin = freopen("/dev/tty", "r", stdin);
+     }
+ 
+     // Set capture input file
+diff --git a/src/curses/ui_manager.c b/src/curses/ui_manager.c
+index ff29c35..f0dfb74 100644
+--- a/src/curses/ui_manager.c
++++ b/src/curses/ui_manager.c
+@@ -68,14 +68,10 @@ ncurses_init()
+ {
+     int bg, fg;
+     const char *term;
+-    FILE *fstdin;
+ 
+     // Set Locale
+     setlocale(LC_CTYPE, "");
+ 
+-    // Allow reading from stdin
+-    fstdin = freopen("/dev/tty", "r", stdin);
+-
+     // Initialize curses
+     if (!initscr()) {
+         fprintf(stderr, "Unable to initialize ncurses mode.\n");
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..c32f6b6
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+fix_stdin.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/sngrep.git



More information about the Pkg-voip-commits mailing list