Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Feb 2013 18:02:40 GMT
From:      John Bayly <freebsd.ports@tipstrade.net>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/176178: Implement upstream fix where multiple iaxmodem instances are spawned
Message-ID:  <201302151802.r1FI2eAp043867@red.freebsd.org>
Resent-Message-ID: <201302151810.r1FIA0ED058626@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         176178
>Category:       ports
>Synopsis:       Implement upstream fix where multiple iaxmodem instances are spawned
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Feb 15 18:10:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     John Bayly
>Release:        7.3-RELEASE
>Organization:
TipsTrade Ltd.
>Environment:
FreeBSD rack 7.3-RELEASE-p2 FreeBSD 7.3-RELEASE-p2 #7: Fri Feb  4 15:47:31 GMT 2011     baylyj@rack:/usr/obj/usr/src/sys/S5500BC  amd64

>Description:
Multiple instances of iaxmodem are being spawned due to a badly placed closedir call. The fix has been submitted (and accepted) upstream, however there has been no new release since the fix was submitted. I've been running *my* patched version since November 2011 without a hickhup.

http://sourceforge.net/tracker/?func=detail&aid=3438845&group_id=148814&atid=772727


>How-To-Repeat:
Running an iaxmodem device will cause multiple instances of iaxmodem to spawn.
>Fix:
Patch iaxmodem.c using the following patch

Patch attached with submission follows:

--- iaxmodem.c.orig	2009-02-21 18:57:05.000000000 +0000
+++ iaxmodem.c	2011-11-16 16:18:48.000000000 +0000
@@ -21,17 +21,18 @@
 #include <string.h>
 #include <strings.h>
 
-#ifndef __OpenBSD__
+#if !defined(__OpenBSD__) && !defined(__FreeBSD__)
 # ifndef USE_UNIX98_PTY
 #  include <pty.h>
 # endif /* !USE_UNIX98_PTY */
 #else
+#include <termios.h>
+#if !defined(__FreeBSD__)
 # include <util.h>
 #endif
+#endif
 
 
-#include <termios.h>
-
 #include <stdlib.h>
 #include <unistd.h>
 #include <dirent.h>
@@ -53,6 +54,26 @@
 #include <math.h>
 
 #include <stdint.h>
+
+#ifdef __FreeBSD__
+#include <libutil.h>
+char* strndup(const char* string, size_t n)
+{
+        char* copy_string = 0;
+
+        if(0 == string || 0 == n)
+                return 0;
+
+        copy_string = (char*) malloc(n + 1);
+        if(0 == copy_string)
+                return 0;
+
+        memcpy(copy_string, string, n);
+        *(copy_string + n) = '\0';
+
+        return copy_string;
+}
+#endif
 #include <tiffio.h>
 
 #ifndef O_LARGEFILE
@@ -1645,8 +1666,6 @@
 	}
       }
 
-    closedir(cfdir);
-
     if (pid == 0) {
       /* Start the modem */
       iaxmodem(config, 0);
@@ -1654,6 +1673,8 @@
       return 1;
     }
 
+    closedir(cfdir);
+
     return 0;
 }
 


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201302151802.r1FI2eAp043867>