mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Update ttyname_r to current coding conventions.
This commit is contained in:
parent
f384fcdff1
commit
56267517ec
1 changed files with 2 additions and 3 deletions
|
@ -31,8 +31,7 @@ extern "C" int ttyname_r(int fd, char* path, size_t path_size)
|
|||
if ( isatty(fd) < 1 )
|
||||
return -1;
|
||||
const char* result = "/dev/tty";
|
||||
size_t result_length = strlen(result);
|
||||
if ( result_length + 1 < path_size )
|
||||
if ( path_size <= strlcpy(path, result, path_size) )
|
||||
return errno = ERANGE, -1;
|
||||
return strcpy(path, result), 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue