From owner-freebsd-hackers@FreeBSD.ORG Fri Jul 8 13:48:56 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6B2D1065670; Fri, 8 Jul 2011 13:48:56 +0000 (UTC) (envelope-from rmh.aybabtu@gmail.com) Received: from mail-pz0-f54.google.com (mail-pz0-f54.google.com [209.85.210.54]) by mx1.freebsd.org (Postfix) with ESMTP id 430888FC17; Fri, 8 Jul 2011 13:48:56 +0000 (UTC) Received: by pzk27 with SMTP id 27so1949887pzk.13 for ; Fri, 08 Jul 2011 06:48:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=wNCU5YeC4igysRyhQUGj6wrLettEe1lwonuGMt/pMes=; b=Qukc4NgWmbkP4j8n9DjVgOzsiSkSHMXZn6Z2q2V+SWxe2QAmD4P3W/fNdorywAzbbB bdMt/nSElSNVKegM4pe0VLvnG2hGJS0kYhWjrR4uj+pwOp8Jp3h8OuD/wiD2hkgu8n3R spWJ+fUuDApdCUTRBGa4v62gdB116qgJwVYZY= MIME-Version: 1.0 Received: by 10.68.50.198 with SMTP id e6mr2826146pbo.292.1310132935793; Fri, 08 Jul 2011 06:48:55 -0700 (PDT) Sender: rmh.aybabtu@gmail.com Received: by 10.68.57.4 with HTTP; Fri, 8 Jul 2011 06:48:55 -0700 (PDT) In-Reply-To: <20110707111751.GI71453@hoeg.nl> References: <20110707100123.GF71453@hoeg.nl> <20110707111751.GI71453@hoeg.nl> Date: Fri, 8 Jul 2011 15:48:55 +0200 X-Google-Sender-Auth: FI9UMJPKpze-88NBH8cKWOshedk Message-ID: From: Robert Millan To: Ed Schouten Content-Type: multipart/mixed; boundary=bcaec544eb763f1c1804a78f1802 Cc: freebsd-hackers@freebsd.org, Ed Maste , debian-hurd@lists.debian.org Subject: Re: [PATCH] avoid assuming MAXPATHLEN in config(8) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jul 2011 13:48:56 -0000 --bcaec544eb763f1c1804a78f1802 Content-Type: text/plain; charset=UTF-8 2011/7/7 Ed Schouten : > Considering that the function is rather small anyway, why not compile it > in unconditionally (though having a different name). Hi Ed, I made the adjustment you requested, plus a bit more polishing (plugged a memleak, etc), and then I hit what seems like a memory corruption heisenbug. I haven't been able to determine whether my patch introduces this bug or it just uncovers it. As for now please disregard my request untill I have time to debug this properly. Thanks -- Robert Millan --bcaec544eb763f1c1804a78f1802 Content-Type: text/plain; charset=US-ASCII; name="maxpathlen.diff" Content-Disposition: attachment; filename="maxpathlen.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gpv7b3xu1 PT09IG1vZGlmaWVkIGZpbGUgJ2NvbmZpZy5oJwotLS0gY29uZmlnLmgJMjAxMS0wNy0wNyAxMzo1 OTowNSArMDAwMAorKysgY29uZmlnLmgJMjAxMS0wNy0wNyAxNDowNjoyOCArMDAwMApAQCAtMTk5 LDcgKzE5OSw3IEBACiBleHRlcm4gaW50CW1heHVzZXJzOwogCiBleHRlcm4gY2hhciAqUFJFRklY OwkJLyogQ29uZmlnIGZpbGUgbmFtZSAtIGZvciBlcnJvciBtZXNzYWdlcyAqLwotZXh0ZXJuIGNo YXIgc3JjZGlyW107CQkvKiByb290IG9mIHRoZSBrZXJuZWwgc291cmNlIHRyZWUgKi8KK2V4dGVy biBjaGFyICpzcmNkaXI7CQkvKiByb290IG9mIHRoZSBrZXJuZWwgc291cmNlIHRyZWUgKi8KIAog I2RlZmluZSBlcShhLGIpCSghc3RyY21wKGEsYikpCiAjZGVmaW5lIG5zKHMpCXN0cmR1cChzKQoK PT09IG1vZGlmaWV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