mirror of
https://github.com/darlinghq/darling.git
synced 2024-11-23 12:19:43 +00:00
Null-terminate strings returned from fcntl(F_GETPATH)
This commit is contained in:
parent
44e8877849
commit
038afe83f0
@ -67,9 +67,15 @@ long sys_fcntl_nocancel(int fd, int cmd, long arg)
|
||||
case F_GETPATH:
|
||||
{
|
||||
char buf[100];
|
||||
int len;
|
||||
|
||||
sprintf(buf, "/proc/self/fd/%d", fd);
|
||||
return sys_readlink(buf, (char*) arg, MAXPATHLEN);
|
||||
len = sys_readlink(buf, (char*) arg, MAXPATHLEN);
|
||||
|
||||
if (len >= 0)
|
||||
((char*) arg)[len] = '\0';
|
||||
|
||||
return len;
|
||||
}
|
||||
// TODO: implement remaining commands
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user