From owner-svn-ports-all@freebsd.org Wed Feb 13 21:56:11 2019 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5CAFE14D9514; Wed, 13 Feb 2019 21:56:11 +0000 (UTC) (envelope-from bsam@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EF87B763EB; Wed, 13 Feb 2019 21:56:10 +0000 (UTC) (envelope-from bsam@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DE59C2D309; Wed, 13 Feb 2019 21:56:10 +0000 (UTC) (envelope-from bsam@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1DLuAqK070846; Wed, 13 Feb 2019 21:56:10 GMT (envelope-from bsam@FreeBSD.org) Received: (from bsam@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1DLuAPK070844; Wed, 13 Feb 2019 21:56:10 GMT (envelope-from bsam@FreeBSD.org) Message-Id: <201902132156.x1DLuAPK070844@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bsam set sender to bsam@FreeBSD.org using -f From: Boris Samorodov Date: Wed, 13 Feb 2019 21:56:10 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r492865 - in head/devel/libserialport: . files X-SVN-Group: ports-head X-SVN-Commit-Author: bsam X-SVN-Commit-Paths: in head/devel/libserialport: . files X-SVN-Commit-Revision: 492865 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EF87B763EB X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; NEURAL_HAM_SHORT(-0.97)[-0.973,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Feb 2019 21:56:11 -0000 Author: bsam Date: Wed Feb 13 21:56:10 2019 New Revision: 492865 URL: https://svnweb.freebsd.org/changeset/ports/492865 Log: devel/libserialport: Don't open serial ports when enumerating PR: 230843 Submitted by: kevans Added: head/devel/libserialport/files/ head/devel/libserialport/files/patch-freebsd.c (contents, props changed) Modified: head/devel/libserialport/Makefile Modified: head/devel/libserialport/Makefile ============================================================================== --- head/devel/libserialport/Makefile Wed Feb 13 21:07:13 2019 (r492864) +++ head/devel/libserialport/Makefile Wed Feb 13 21:56:10 2019 (r492865) @@ -3,6 +3,7 @@ PORTNAME= libserialport PORTVERSION= 0.1.1 +PORTREVISION= 1 CATEGORIES= devel MASTER_SITES= http://sigrok.org/download/source/libserialport/ Added: head/devel/libserialport/files/patch-freebsd.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/libserialport/files/patch-freebsd.c Wed Feb 13 21:56:10 2019 (r492865) @@ -0,0 +1,37 @@ +--- freebsd.c.orig 2018-07-17 13:22:11 UTC ++++ freebsd.c +@@ -327,9 +327,8 @@ SP_PRIV enum sp_return list_ports(struct sp_port ***li + DIR *dir; + struct dirent entry; + struct dirent *result; +- struct termios tios; + char name[PATH_MAX]; +- int fd, ret; ++ int ret; + + DEBUG("Enumerating tty devices"); + if (!(dir = opendir("/dev"))) +@@ -353,21 +352,10 @@ SP_PRIV enum sp_return list_ports(struct sp_port ***li + DEBUG_FMT("Found device %s", name); + + /* Check that we can open tty/cua device in rw mode - we need that. */ +- if ((fd = open(name, O_RDWR | O_NONBLOCK | O_NOCTTY | O_TTY_INIT | O_CLOEXEC)) < 0) { +- DEBUG("Open failed, skipping"); ++ if (access(name, R_OK | W_OK) != 0) { ++ DEBUG("access(2) check failed, skipping"); + continue; + } +- +- /* Sanity check if we got a real tty. */ +- if (!isatty(fd)) { +- close(fd); +- continue; +- } +- +- ret = tcgetattr(fd, &tios); +- close(fd); +- if (ret < 0 || cfgetospeed(&tios) <= 0 || cfgetispeed(&tios) <= 0) +- continue; + + DEBUG_FMT("Found port %s", name); + DBG("%s: %s\n", __func__, entry.d_name);