Bug 195126 - [PATCH] rfcomm_sppd(1): Always output allocated pty
Summary: [PATCH] rfcomm_sppd(1): Always output allocated pty
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-17 22:56 UTC by Timo Buhrmester
Modified: 2014-11-20 04:20 UTC (History)
0 users

See Also:


Attachments
Always print allocated pty to stdout (860 bytes, patch)
2014-11-17 22:56 UTC, Timo Buhrmester
no flags Details | Diff
Always print+flush allocated pty to stdout (879 bytes, patch)
2014-11-17 23:09 UTC, Timo Buhrmester
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Timo Buhrmester 2014-11-17 22:56:55 UTC
Created attachment 149537 [details]
Always print allocated pty to stdout

When rfcomm_sppd is told to daemonize (-b), it does not write the name of the pty it obtained through openpty() to standard output.  This probably wasn't a problem before openpty() was used, as one had to manually specify which pty should be used.

The attached patch causes rfcomm_sppd to unconditionally output the path to the allocated pty, before daemonizing.  Without it, there is no (robust) way to determine which pty was allocated, after the fact.

Best,
Timo Buhrmester
Comment 1 Timo Buhrmester 2014-11-17 23:09:01 UTC
Created attachment 149538 [details]
Always print+flush allocated pty to stdout

A fflush(stdout) was missing in the original patch, to flush the stdio buffer before daemonizing. This patch adds that.