]> sourceware.org Git - newlib-cygwin.git/commitdiff
* fhandler.cc (fhandler_disk_file::fstat): Don't rely on exactly 3 characters
authorChristopher Faylor <me@cgf.cx>
Tue, 26 Jun 2001 21:03:08 +0000 (21:03 +0000)
committerChristopher Faylor <me@cgf.cx>
Tue, 26 Jun 2001 21:03:08 +0000 (21:03 +0000)
being read for executable test since we could be checking for less than that.
* syscalls.cc (stat_worker): Try opening the file the "correct" way first so
that #! processing can potentially happen.  If that fails, then use "query
open" method.
* spawn.cc (spawn_guts): Delay processing of signal until after we've notified
parent about reparenting.

winsup/cygwin/ChangeLog
winsup/cygwin/fhandler.cc
winsup/cygwin/spawn.cc
winsup/cygwin/syscalls.cc

index b1f56ed0d6daf62a2230dcfb78527096fc6f980b..a04141e6625efd0bd97532d49a2a6dcb20b805bb 100644 (file)
@@ -1,3 +1,15 @@
+Tue Jun 26 16:59:16 2001  Christopher Faylor <cgf@cygnus.com>
+
+       * fhandler.cc (fhandler_disk_file::fstat): Don't rely on exactly 3
+       characters being read for executable test since we could be checking
+       for less than that.
+       * syscalls.cc (stat_worker): Try opening the file the "correct" way
+       first so that #! processing can potentially happen.  If that fails,
+       then use "query open" method.
+
+       * spawn.cc (spawn_guts): Delay processing of signal until after we've
+       notified parent about reparenting.
+
 Tue Jun 26 10:47:24 2001  Christopher Faylor <cgf@cygnus.com>
 
        * mmap.cc: Clean up *ResourceLock calls throughout.
index 6c745c0972993fe53dfc11333e75f0b8d539f997..65ef21411f128ce8c708d9a14a4198fd82fd6b3a 100644 (file)
@@ -993,8 +993,8 @@ fhandler_disk_file::fstat (struct stat *buf)
                  {
                    /* FIXME should we use /etc/magic ? */
                    magic[0] = magic[1] = magic[2] = '\0';
-                   if (ReadFile (get_handle (), magic, 3, &done, 0) &&
-                       done == 3 && has_exec_chars (magic, done))
+                   if (ReadFile (get_handle (), magic, 3, &done, NULL) &&
+                       has_exec_chars (magic, done))
                        set_execable_p ();
                    SetFilePointer (get_handle(), cur, NULL, FILE_BEGIN);
                  }
index db2603e3073422d950f7c8bacfc8aee0127ad7db..d461e532b1f1ce5d0447ef5536ac14c0a7513c55 100644 (file)
@@ -743,6 +743,7 @@ skip_arg_parsing:
 
   HANDLE waitbuf[3] = {pi.hProcess, signal_arrived, spr};
   int nwait = 3;
+  bool saw_signal = 0;
 
   res = 0;
   exited = FALSE;
@@ -761,8 +762,8 @@ skip_arg_parsing:
          break;
        case WAIT_OBJECT_0 + 1:
          sigproc_printf ("signal arrived");
-         // reset_signal_arrived ();
-         thisframe.call_signal_handler ();
+         reset_signal_arrived ();
+         saw_signal = 1;
          continue;
        case WAIT_OBJECT_0 + 2:
          if (mode == _P_OVERLAY)
@@ -820,6 +821,9 @@ skip_arg_parsing:
        }
     }
 
+  if (saw_signal && mode != _P_OVERLAY)
+    thisframe.call_signal_handler ();
+
   MALLOC_CHECK;
 
   switch (mode)
index 23b6540e3939a63c5216f86f8148111edd923658..8b1a41e1e857dc65d002876f7d418c97f10aa9d8 100644 (file)
@@ -1069,9 +1069,16 @@ stat_worker (const char *caller, const char *name, struct stat *buf,
        && dtype != DRIVE_NO_ROOT_DIR
        && dtype != DRIVE_UNKNOWN)))
     {
-      fh.set_query_open (TRUE);
       oret = fh.open (real_path, O_RDONLY | O_BINARY | O_DIROPEN |
                                 (nofollow ? O_NOSYMLINK : 0), 0);
+      /* If we couldn't open the file, try a "query open" with no permissions.
+        This will allow us to determine *some* things about the file, at least. */
+      if (!oret)
+       {
+         fh.set_query_open (TRUE);
+         oret = fh.open (real_path, O_RDONLY | O_BINARY | O_DIROPEN |
+                                    (nofollow ? O_NOSYMLINK : 0), 0);
+       }
       /* Check a special case here. If ntsec is ON it happens
         that a process creates a file using mode 000 to disallow
         other processes access. In contrast to UNIX, this results
This page took 0.041216 seconds and 5 git commands to generate.