On Fri, Sep 21, 2007 at 04:39:49PM +0200, Christoph Egger wrote:
> Which form is better (a) or b))?
> 
> a)
> 
> char slave[80];
> ...
> 
> if (openpty(&masterfd, &slavefd, slave, NULL, NULL) < 0)

char slave[PATH_MAX] ?

I think it's a reasonable assumption that no library function
will return (on any system out there) a path longer than PATH_MAX.

> if (openpty(&masterfd, &slavefd, NULL, NULL, NULL) < 0)
>  ...
> 
> slave = ptsname(masterfd);

'ttyname(slavefd)' will do.

Reply via email to