Skip to content

Commit

Permalink
fix the break of MSRV
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveLauC committed Oct 3, 2022
1 parent 265b2dd commit a73b12c
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/unix/solarish/compat.rs
Expand Up @@ -178,7 +178,15 @@ pub unsafe fn getpwent_r(
) -> ::c_int {
let old_errno = *::___errno();
*::___errno() = 0;
*result = native_getpwent_r(pwd, buf, buflen.min(::c_int::MAX as ::size_t) as ::c_int);
*result = native_getpwent_r(
pwd,
buf,
if buflen < (::c_int::max_value() as ::size_t) {
buflen as ::c_int
} else {
::c_int::max_value()
},
);

let ret = if (*result).is_null() {
*::___errno()
Expand All @@ -198,7 +206,15 @@ pub unsafe fn getgrent_r(
) -> ::c_int {
let old_errno = *::___errno();
*::___errno() = 0;
*result = native_getgrent_r(grp, buf, buflen.min(::c_int::MAX as ::size_t) as ::c_int);
*result = native_getgrent_r(
grp,
buf,
if buflen < (::c_int::max_value() as ::size_t) {
buflen as ::c_int
} else {
::c_int::max_value()
},
);

let ret = if (*result).is_null() {
*::___errno()
Expand Down

0 comments on commit a73b12c

Please sign in to comment.