diff --git a/sys/compat/linux/linux_getcwd.c b/sys/compat/linux/linux_getcwd.c --- a/sys/compat/linux/linux_getcwd.c +++ b/sys/compat/linux/linux_getcwd.c @@ -74,6 +74,8 @@ buf = malloc(buflen, M_TEMP, M_WAITOK); error = vn_getcwd(buf, &retbuf, &buflen); + if (error == ENOMEM) + error = ERANGE; if (error == 0) { error = copyout(retbuf, uap->buf, buflen); if (error == 0)