From 4a8bce89d10b92fe8dbef8a5adf202ee0ed27e83 Mon Sep 17 00:00:00 2001 From: "Steven G. Kargl" Date: Sat, 21 Oct 2006 22:38:56 +0000 Subject: [PATCH] error.c: Add errno.h 2006-10-21 Steven G. Kargl * runtime/error.c: Add errno.h (generate_error): Set iostat to errno on OS error. * libgfortran.h: Set ERROR_OS to 5000 From-SVN: r117939 --- libgfortran/ChangeLog | 6 ++++++ libgfortran/libgfortran.h | 2 +- libgfortran/runtime/error.c | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 19c2a92a3f6..a9e70825f80 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2006-10-21 Steven G. Kargl + + * runtime/error.c: Add errno.h + (generate_error): Set iostat to errno on OS error. + * libgfortran.h: Set ERROR_OS to 5000 + 2006-10-20 Francois-Xavier Coudert * generated/minval_r8.c: Regenerate. diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h index cdbde51f0af..e023f0ea26e 100644 --- a/libgfortran/libgfortran.h +++ b/libgfortran/libgfortran.h @@ -397,7 +397,7 @@ typedef enum ERROR_EOR = -2, ERROR_END = -1, ERROR_OK = 0, /* Indicates success, must be zero. */ - ERROR_OS, /* Operating system error, more info in errno. */ + ERROR_OS = 5000, /* Operating system error, more info in errno. */ ERROR_OPTION_CONFLICT, ERROR_BAD_OPTION, ERROR_MISSING_OPTION, diff --git a/libgfortran/runtime/error.c b/libgfortran/runtime/error.c index 9960733f16a..f8f76d3d26f 100644 --- a/libgfortran/runtime/error.c +++ b/libgfortran/runtime/error.c @@ -34,6 +34,7 @@ Boston, MA 02110-1301, USA. */ #include #include #include +#include #include "libgfortran.h" #include "../io/io.h" @@ -457,7 +458,7 @@ generate_error (st_parameter_common *cmp, int family, const char *message) { /* Set the error status. */ if ((cmp->flags & IOPARM_HAS_IOSTAT)) - *cmp->iostat = family; + *cmp->iostat = (family == ERROR_OS) ? errno : family; if (message == NULL) message =