From owner-freebsd-hackers Tue Dec 9 15:50:06 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id PAA18860 for hackers-outgoing; Tue, 9 Dec 1997 15:50:06 -0800 (PST) (envelope-from owner-freebsd-hackers) Received: from wafu.netgate.net (wafu.netgate.net [204.145.147.80]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id PAA18802 for ; Tue, 9 Dec 1997 15:49:56 -0800 (PST) (envelope-from shigio@wafu.netgate.net) Received: from chiota.signet.or.jp (INS54.tama.dti.ne.jp [210.159.144.8]) by wafu.netgate.net (8.7.5/8.7.3) with ESMTP id PAA11441; Tue, 9 Dec 1997 15:52:01 GMT Message-Id: <199712091552.PAA11441@wafu.netgate.net> Received: from chiota.signet.or.jp (localhost.signet.or.jp [127.0.0.1]) by chiota.signet.or.jp (8.8.5/) with ESMTP id IAA00366; Wed, 10 Dec 1997 08:46:14 +0900 (JST) To: Andrew Kenneth Milton cc: shigio@wafu.netgate.net, hackers@FreeBSD.ORG Subject: Re: [RFC] path converting functions. In-reply-to: Message from Andrew Kenneth Milton Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk of "Wed, 10 Dec 1997 03:16:04 +1100." <199712091616.DAA20863@mother.sneaker.net.au> Date: Wed, 10 Dec 1997 08:46:14 +0900 From: Shigio Yamaguchi > +-----[ John Polstra ]------------------------------ > | > | In article <199712032230.WAA28837@wafu.netgate.net>, > | Shigio Yamaguchi wrote: > | > | > > | > abs2rel - make a relative path name from an absolute path name > | > > | > abs2rel(, , ); > | > > | > > | > /usr/src /etc ../usr/src > | > | Since your functions write into the user-supplied buffer "result", > | you should add an argument that specifies how big it is. > > And always return an error if they haven't allocated MAXPATHLEN :-) > That'll teach 'em. In realpath(3) style, it is user's responsibility to allocate a buffer capable of storing at least MAXPATHLEN characters. When generated path name is longer than MAXPATHLEN - 1, abs2rel and rel2abs returns -1 and set errno = ENAMETOOLONG. -- Shigio Yamaguchi (Freelance programmer) Mail: shigio@wafu.netgate.net, WWW: http://wafu.netgate.net/tama/