Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Dec 1997 08:46:14 +0900
From:      Shigio Yamaguchi <shigio@wafu.netgate.net>
To:        Andrew Kenneth Milton <akm@mother.sneaker.net.au>
Cc:        shigio@wafu.netgate.net, hackers@FreeBSD.ORG
Subject:   Re: [RFC] path converting functions. 
Message-ID:  <199712091552.PAA11441@wafu.netgate.net>
In-Reply-To: Message from Andrew Kenneth Milton <akm@mother.sneaker.net.au>

next in thread | previous in thread | raw e-mail | index | archive | help
> +-----[ John Polstra ]------------------------------
> | 
> | In article <199712032230.WAA28837@wafu.netgate.net>,
> | Shigio Yamaguchi  <shigio@wafu.netgate.net> wrote:
> | 
> | > 
> | > abs2rel - make a relative path name from an absolute path name
> | > 
> | > 	abs2rel(<original path name>, <base directory>, <result>);
> | > 
> | > 	<original path name>	<base directory>	<result>
> | > 	/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/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199712091552.PAA11441>