Bug 184597

Summary: [PATCH] Fix rfcomm_sppd(1) pseudo slave TTY mode
Product: Base System Reporter: Tobias Rehbein <tobias.rehbein>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me CC: m_evmenkin
Priority: Normal    
Version: 10.0-BETA4   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
rfcomm_sppd-to-pts-openpty.diff
none
rfcomm_sppd-to-pts-openpty.2.diff
none
rfcomm_sppd-to-pts-openpty.3.diff none

Description Tobias Rehbein 2013-12-08 16:20:01 UTC
	rfcomm_sppd uses the deprecated pty(4) driver to implement its pseudo slave TTY mode (invoked by the '-t tty' option). This breaks on recent FreeBSD systems. In order to fix this I changed the code to use the openpty(3) API which uses the pts(4) driver instead of the pty(4) driver.

	The patch works fine for me, but there is one regression in functionality: The old code allowed the user to select the name of the pseudo terminal. This no longer works using the pts(4) driver, the name is always automatically selected by the pts(4) driver. But maybe I missed something here.
Comment 1 Tobias Rehbein 2013-12-12 18:11:40 UTC
Update:
- Close file descriptors if strdup(3) call fails
Comment 2 graham 2014-02-05 09:09:07 UTC
Thanks Tobias - it works beautifully.

Please commit this fix as the current code is broken on FreeBSD >= 8.

Thanks,
    Graham
Comment 3 Tobias Rehbein 2014-08-10 09:28:59 UTC
Created attachment 145607 [details]
rfcomm_sppd-to-pts-openpty.3.diff

Another update to the patch.

Print the name of the pts(4) to use on stdout. This way wrapper scripts/tools can easily pick it up.
Comment 4 commit-hook freebsd_committer freebsd_triage 2014-10-23 15:17:21 UTC
A commit references this bug:

Author: emax
Date: Thu Oct 23 15:16:42 UTC 2014
New revision: 273548
URL: https://svnweb.freebsd.org/changeset/base/273548

Log:
  Change the code to use the openpty(3) API which uses the pts(4) driver
  instead of the pty(4) driver.

  PR:		184597
  Submitted by:	tobias.rehbein
  MFC after:	2 weeks

Changes:
  head/usr.bin/bluetooth/rfcomm_sppd/Makefile
  head/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.1
  head/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c
Comment 5 commit-hook freebsd_committer freebsd_triage 2014-11-06 16:32:51 UTC
A commit references this bug:

Author: emax
Date: Thu Nov  6 16:32:01 UTC 2014
New revision: 274182
URL: https://svnweb.freebsd.org/changeset/base/274182

Log:
  MFC r273548

  Change the code to use the openpty(3) API which uses the pts(4) driver
  instead of the pty(4) driver.

  PR:		184597
  Submitted by:	tobias.rehbein

Changes:
_U  stable/10/
  stable/10/usr.bin/bluetooth/rfcomm_sppd/Makefile
  stable/10/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.1
  stable/10/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c
Comment 6 Mark Linimon freebsd_committer freebsd_triage 2015-03-10 01:50:42 UTC
Committed as 273548.