libexplain
1.4.D001
|
Go to the source code of this file.
Functions | |
const char * | explain_lseek (int fildes, off_t offset, int whence) |
const char* explain_lseek | ( | int | fildes, |
off_t | offset, | ||
int | whence | ||
) |
The explain_lseek function is used to obtain an explanation of an error returned by the lseek(2) system call. The least the message will contain is the value of strerror(errno)
, but usually it will do much better, and indicate the underlying cause in more detail.
The errno global variable will be used to obtain the error value to be decoded.
fildes | The original fildes, exactly as passed to the lseek(2) system call. |
offset | The original offset, exactly as passed to the lseek(2) system call. |
whence | The original whence, exactly as passed to the lseek(2) system call. |
off_t result = lseek(fildes, offset, whence); if (result < 0) { fprintf(stderr, "%s\n", explain_lseek(fildes, offset, whence)); exit(EXIT_FAILURE); }