Fix ttyname_r error return values
POSIX specifies ttyname_r should return errno and not do the usual return errno = error, -1; Fixes #732
This commit is contained in:
parent
4379ca962a
commit
e2c57ad789
1 changed files with 2 additions and 2 deletions
|
@ -37,8 +37,8 @@ int ttyname_r(int fd, char* path, size_t path_size)
|
|||
name[3] = 'v';
|
||||
name[4] = '/';
|
||||
if ( ioctl(fd, TIOCGNAME, name + 5) < 0 )
|
||||
return -1;
|
||||
return errno;
|
||||
if ( path_size <= strlcpy(path, name, path_size) )
|
||||
return errno = ERANGE, -1;
|
||||
return ERANGE;
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue