Skip to content

Commit

Permalink
Make this use strerror to get the errno message
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed Oct 8, 2024
1 parent a84bc99 commit 428ca8b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions core/src/main/java/org/jruby/Ruby.java
Original file line number Diff line number Diff line change
Expand Up @@ -3838,10 +3838,17 @@ public RaiseException newErrnoETIMEDOUTError() {
}

public RaiseException newErrnoFromLastPOSIXErrno() {
RubyClass errnoClass = getErrno(getPosix().errno());
if (errnoClass == null) errnoClass = systemCallError;
String message = null;
int errno = getPosix().errno();
RubyClass errnoClass = getErrno(errno);
if (errnoClass == null) {
errnoClass = systemCallError;
} else {
message = getPosix().strerror(errno);
}


return newRaiseException(errnoClass, null);
return newRaiseException(errnoClass, message);
}

public RaiseException newErrnoFromInt(int errno, String methodName, String message) {
Expand Down

0 comments on commit 428ca8b

Please sign in to comment.