Function gio::functions::io_error_from_errno

source ·
pub fn io_error_from_errno(err_no: i32) -> IOErrorEnum
Expand description

Converts errno.h error codes into GIO error codes.

The fallback value IOErrorEnum::Failed is returned for error codes not currently handled (but note that future GLib releases may return a more specific value instead).

As errno is global and may be modified by intermediate function calls, you should save its value immediately after the call returns, and use the saved value instead of errno:

⚠️ The following code is in C ⚠️

  int saved_errno;

  ret = read (blah);
  saved_errno = errno;

  g_io_error_from_errno (saved_errno);

§err_no

Error number as defined in errno.h.

§Returns

#GIOErrorEnum value for the given errno.h error number