summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>2016-12-19 13:41:32 +0000
committerfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>2016-12-19 13:41:32 +0000
commit2b8711b1493b67536aeb82e1c86848413b829b27 (patch)
tree660135db4f07e2dcb8c14aadb3c891c9d6343ad2
parentdff08abcc8fc518e706e1a3d22025c34ca8085de (diff)
downloadgcc-2b8711b1493b67536aeb82e1c86848413b829b27.tar.gz
* intrinsics/chmod.c (chmod_internal): Fix case where mode_t is
different from unsigned int. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@243796 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libgfortran/ChangeLog5
-rw-r--r--libgfortran/intrinsics/chmod.c8
2 files changed, 6 insertions, 7 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index a53cc2d7073..129e7325a24 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,8 @@
+2016-12-19 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ * intrinsics/chmod.c (chmod_internal): Fix case where mode_t is
+ different from unsigned int.
+
2016-12-18 Dominique d'Humieres <dominiq@lps.ens.fr>
PR fortran/78545
diff --git a/libgfortran/intrinsics/chmod.c b/libgfortran/intrinsics/chmod.c
index 5aae77b0553..4f4d723daf1 100644
--- a/libgfortran/intrinsics/chmod.c
+++ b/libgfortran/intrinsics/chmod.c
@@ -82,16 +82,10 @@ chmod_internal (char *file, char *mode, gfc_charlen_type mode_len)
if (mode[0] >= '0' && mode[0] <= '9')
{
-#ifdef __MINGW32__
unsigned fmode;
if (sscanf (mode, "%o", &fmode) != 1)
return 1;
- file_mode = (mode_t) fmode;
-#else
- if (sscanf (mode, "%o", &file_mode) != 1)
- return 1;
-#endif
- return chmod (file, file_mode);
+ return chmod (file, (mode_t) fmode);
}
/* Read the current file mode. */