[nmap/f18] use select as default nsock engine

Michal Hlavinka mhlavink at fedoraproject.org
Fri Jan 4 12:07:22 UTC 2013


commit c9504229ae1881d7b03000df9146c35f0214308a
Author: Michal Hlavinka <mhlavink at redhat.com>
Date:   Fri Jan 4 13:07:16 2013 +0100

    use select as default nsock engine

 ncat_reg_stdin.diff |   44 +++++++++++---------------------------------
 nmap.spec           |    5 ++++-
 2 files changed, 15 insertions(+), 34 deletions(-)
---
diff --git a/ncat_reg_stdin.diff b/ncat_reg_stdin.diff
index 8f0632e..e6034b2 100644
--- a/ncat_reg_stdin.diff
+++ b/ncat_reg_stdin.diff
@@ -1,34 +1,12 @@
-diff -up nmap-6.01/ncat/ncat_connect.c.ncat_reg_stdin nmap-6.01/ncat/ncat_connect.c
---- nmap-6.01/ncat/ncat_connect.c.ncat_reg_stdin	2012-03-01 07:53:35.000000000 +0100
-+++ nmap-6.01/ncat/ncat_connect.c	2012-08-08 18:34:36.971502138 +0200
-@@ -458,10 +458,30 @@ bail:
-     return -1;
- }
+diff -up nmap-6.01/ncat/ncat_main.c.noepoll nmap-6.01/ncat/ncat_main.c
+--- nmap-6.01/ncat/ncat_main.c.noepoll	2013-01-04 12:50:18.670295473 +0100
++++ nmap-6.01/ncat/ncat_main.c	2013-01-04 12:50:18.692295660 +0100
+@@ -280,6 +280,8 @@ int main(int argc, char *argv[])
+ #ifdef WIN32
+     windows_init();
+ #endif
++    
++    nsock_set_default_engine("select");
  
-+#if defined(LINUX)
-+static int stdin_is_reg(void) {
-+  struct stat buf;
-+
-+  if (fstat(STDIN_FILENO, &buf) < 0)
-+    fatal("fstat(): %s", strerror(errno));
-+
-+  return S_ISREG(buf.st_mode);
-+}
-+#endif
-+
- int ncat_connect(void) {
-     nsock_pool mypool;
-     int rc;
- 
-+#if defined(LINUX)
-+    /* -- Hack!!
-+     * epoll(7) doesn't support regular files (e.g.: ncat < file.c)
-+     * If we detect that STDIN is a regular file, then we enforce
-+     * the use of the select-based engine. */
-+    if (stdin_is_reg())
-+      nsock_set_default_engine("select");
-+#endif
-+
-     /* Create an nsock pool */
-     if ((mypool = nsp_new(NULL)) == NULL)
-         bye("Failed to create nsock_pool.");
+     while (1) {
+         /* handle command line arguments */
diff --git a/nmap.spec b/nmap.spec
index f980173..e7d3c44 100644
--- a/nmap.spec
+++ b/nmap.spec
@@ -4,7 +4,7 @@ Name: nmap
 Epoch: 2
 Version: 6.01
 #global prerelease TEST5
-Release: 8%{?dist}
+Release: 9%{?dist}
 # nmap is GPLv2
 # zenmap is GPLv2 and LGPLv2+ (zenmap/higwidgets) and GPLv2+ (zenmap/radialnet)
 # libdnet-stripped is BSD (advertising clause rescinded by the Univ. of California in 1999) with some parts as Public Domain (crc32)
@@ -220,6 +220,9 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/man1/xnmap.1.gz
 
 %changelog
+* Fri Jan 04 2013 Michal Hlavinka <mhlavink at redhat.com> - 2:6.01-9
+- use select as default nsock engine
+
 * Thu Nov 29 2012 Michal Hlavinka <mhlavink at redhat.com> - 2:6.01-8
 - call shutdown also in listen mode
 


More information about the scm-commits mailing list