[Dovecot] Build fix on HURD

Timo Sirainen tss at iki.fi
Wed Dec 16 21:14:07 EET 2009


On Wed, 2009-12-16 at 18:46 +0100, Marco Nenciarini wrote:
> http://insanecoding.blogspot.com/2007/11/pathmax-simply-isnt.html */ 

BTW. That does getcwd() in a way too difficult way, at least for POSIX.
This is what I used:

int t_get_current_dir(const char **dir_r)
{
	/* @UNSAFE */
	char *dir;
	size_t size = 128;

	dir = t_buffer_get(size);
	while (getcwd(dir, size) == NULL) {
		if (errno != ERANGE)
			return -1;
		size = nearest_power(size+1);
		dir = t_buffer_get(size);
	}
	t_buffer_alloc(strlen(dir) + 1);
	*dir_r = dir;
	return 0;
}

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://dovecot.org/pipermail/dovecot/attachments/20091216/6af722d2/attachment.bin 


More information about the dovecot mailing list