From owner-freebsd-ports@freebsd.org Tue Apr 26 19:27:21 2016 Return-Path: Delivered-To: freebsd-ports@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D339CB197DE for ; Tue, 26 Apr 2016 19:27:21 +0000 (UTC) (envelope-from abi@abinet.ru) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id C1EE11A52 for ; Tue, 26 Apr 2016 19:27:21 +0000 (UTC) (envelope-from abi@abinet.ru) Received: by mailman.ysv.freebsd.org (Postfix) id BDED0B197DB; Tue, 26 Apr 2016 19:27:21 +0000 (UTC) Delivered-To: ports@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BB760B197D9 for ; Tue, 26 Apr 2016 19:27:21 +0000 (UTC) (envelope-from abi@abinet.ru) Received: from mail.abinet.ru (mail.abinet.ru [136.243.72.227]) by mx1.freebsd.org (Postfix) with ESMTP id 7E0271A50 for ; Tue, 26 Apr 2016 19:27:21 +0000 (UTC) (envelope-from abi@abinet.ru) Received: from [10.0.0.1] (unknown [10.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.abinet.ru (Postfix) with ESMTPSA id 7DE7F52F8 for ; Tue, 26 Apr 2016 19:27:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=abinet.ru; s=dkim; t=1461698833; bh=dbg2wwkCdXclCQ1aP+9Ws7xsAk6BbHJBs06ft27VxhY=; h=Date:From:To:Subject; b=Ua9oCplRjeSy+Q/Vo2HHjyBi+yX4oTXkvPvHIEUVjL9zGW3JmwHmXHHcRfu3A2ens L5deiXPelWV0MWQcVrW7q/nbUprbUEd+kXmWJbUHcY9+XNQh+NVHTzv1q+LDhELfJs xbBeRgGe6BS4r6pPfuzPepYAWNGB7xw3pDfuZZXQ= Message-ID: <571FC10F.2010406@abinet.ru> Date: Tue, 26 Apr 2016 22:27:11 +0300 From: abi User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:) Gecko/20160112 FossaMail/25.2.0 MIME-Version: 1.0 To: ports@freebsd.org Subject: Making a port part II : bind: Who ate a byte ? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2016 19:27:21 -0000 Hello, I'm porting ZoneMinder and making pull requests to avoid FreeBSD specific patches as upstream is happy to merge them. I've noticed that sock files ZM creates has 'soc' extension. This make these file haunt sock folder as they are not cleared for obvious reason after they are not needed. The code, that produces such effect is here: https://github.com/ZoneMinder/ZoneMinder/blob/247cb3d0b2adb8941bd1cd400cf783bdfc71832d/src/zm_stream.cpp#L326 If I increment buffer to 1 (strlen() + sizeof() + 1) created files have correct endings. I can just add +1 if platform is FreeBSD and send this to upstream, however, being not a programmer, I can't tell why it's happening. The code looks generic enough to work on any posix system. How can we lost the byte here? Maybe there is a more proper solution, without #if ?