* [committed, libgfortran]
@ 2016-12-19 13:54 FX
0 siblings, 0 replies; only message in thread
From: FX @ 2016-12-19 13:54 UTC (permalink / raw)
To: GCC-Fortran-ML; +Cc: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 568 bytes --]
In the case where CHMOD is called with a numeric mode, the current code assumes that “mode_t” corresponds to an unsigned int. This is true on linux/glibc, but not true on macOS (where mode_t is an unsigned short) and thus creates a warning and possibly a runtime error. This had been spotted earlier on Windows and was corrected, but behind a __MINWG32__ check, although the fixed code is actually correct for all platforms.
I have thus committed the attached fix (revision 243796), removing the target-specific branch. Will work on all platforms now.
FX
[-- Attachment #2: chmod.ChangeLog --]
[-- Type: application/octet-stream, Size: 158 bytes --]
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.
[-- Attachment #3: chmod.diff --]
[-- Type: application/octet-stream, Size: 624 bytes --]
Index: intrinsics/chmod.c
===================================================================
--- intrinsics/chmod.c (revision 243794)
+++ intrinsics/chmod.c (working copy)
@@ -82,16 +82,10 @@ chmod_internal (char *file, char *mode,
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. */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-12-19 13:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-19 13:54 [committed, libgfortran] FX
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).