]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
open.c (new_unit): Use the right unit number when checking for stdin, stdout, stderr.
authorAlan Modra <amodra@bigpond.net.au>
Wed, 23 Nov 2005 10:18:11 +0000 (10:18 +0000)
committerAlan Modra <amodra@gcc.gnu.org>
Wed, 23 Nov 2005 10:18:11 +0000 (20:48 +1030)
* io/open.c (new_unit): Use the right unit number when checking
for stdin, stdout, stderr.

From-SVN: r107413

libgfortran/ChangeLog
libgfortran/io/open.c

index eff28802c2389597c67d206f493a69cd86b5980d..c777d347c4e6023fa7d4dfca197e4423c3671068 100644 (file)
@@ -1,3 +1,8 @@
+2005-11-23  Alan Modra  <amodra@bigpond.net.au>
+
+       * io/open.c (new_unit): Use the right unit number when checking
+       for stdin, stdout, stderr.
+
 2005-11-22  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        PR libgfortran/24794
index a1bc99b70eb5eccbe4dbcf4f801ddc35cc94c654..54595097049b1c165aaf064df61d676b7346fc1a 100644 (file)
@@ -339,9 +339,9 @@ new_unit (st_parameter_open *opp, gfc_unit *u, unit_flags * flags)
   if ((opp->common.flags & IOPARM_OPEN_HAS_FILE) != 0)
     u2 = find_file (opp->file, opp->file_len);
   if (u2 != NULL
-      && (options.stdin_unit < 0 || u->unit_number != options.stdin_unit)
-      && (options.stdout_unit < 0 || u->unit_number != options.stdout_unit)
-      && (options.stderr_unit < 0 || u->unit_number != options.stderr_unit))
+      && (options.stdin_unit < 0 || u2->unit_number != options.stdin_unit)
+      && (options.stdout_unit < 0 || u2->unit_number != options.stdout_unit)
+      && (options.stderr_unit < 0 || u2->unit_number != options.stderr_unit))
     {
       unlock_unit (u2);
       generate_error (&opp->common, ERROR_ALREADY_OPEN, NULL);