OSDN Git Service

Actually check in files.
authorcgf <cgf>
Sun, 17 Apr 2005 00:12:13 +0000 (00:12 +0000)
committercgf <cgf>
Sun, 17 Apr 2005 00:12:13 +0000 (00:12 +0000)
winsup/cygwin/fhandler.h
winsup/cygwin/fhandler_disk_file.cc
winsup/cygwin/fhandler_fifo.cc
winsup/cygwin/pinfo.cc

index 6ad3a82..a7fcb90 100644 (file)
@@ -495,7 +495,7 @@ public:
   void create_guard (SECURITY_ATTRIBUTES *sa) {guard = CreateMutex (sa, FALSE, NULL);}
   int dup (fhandler_base *child);
   int ioctl (unsigned int cmd, void *);
-  void fixup_after_fork (HANDLE);
+  virtual void fixup_after_fork (HANDLE);
   void fixup_after_exec ();
   bool hit_eof ();
   void set_eof () {broken_pipe = true;}
@@ -509,7 +509,6 @@ public:
 class fhandler_fifo: public fhandler_pipe
 {
   HANDLE output_handle;
-  HANDLE owner;                // You can't have too many mutexes, now, can you?
   long read_use;
   long write_use;
   virtual HANDLE& get_io_handle () { return io_handle ?: output_handle; }
index 280aa07..2865d87 100644 (file)
@@ -219,7 +219,7 @@ fhandler_base::fstat_fs (struct __stat64 *buf)
 
   if (get_io_handle ())
     {
-      if (nohandle ())
+      if (nohandle () || is_fs_special ())
        return fstat_by_name (buf);
       else
        return fstat_by_handle (buf);
@@ -325,7 +325,7 @@ fhandler_base::fstat_helper (struct __stat64 *buf,
     buf->st_blocks = (nAllocSize + S_BLKSIZE - 1) / S_BLKSIZE;
   else if (pc.has_attribute (FILE_ATTRIBUTE_COMPRESSED
                             | FILE_ATTRIBUTE_SPARSE_FILE)
-      && get_io_handle ()
+      && get_io_handle () && !is_fs_special ()
       && !NtQueryInformationFile (get_io_handle (), &st, (PVOID) &fci,
                                  sizeof fci, FileCompressionInformation))
     /* Otherwise we request the actual amount of bytes allocated for
@@ -352,8 +352,8 @@ fhandler_base::fstat_helper (struct __stat64 *buf,
   else if (pc.issocket ())
     buf->st_mode = S_IFSOCK;
 
-  if (!get_file_attribute (pc.has_acls (), get_io_handle (), get_win32_name (),
-                          &buf->st_mode, &buf->st_uid, &buf->st_gid))
+  if (!get_file_attribute (pc.has_acls (), is_fs_special () ? NULL: get_io_handle (),
+                          get_win32_name (), &buf->st_mode, &buf->st_uid, &buf->st_gid))
     {
       /* If read-only attribute is set, modify ntsec return value */
       if (pc.has_attribute (FILE_ATTRIBUTE_READONLY) && !pc.issymlink ())
@@ -373,7 +373,7 @@ fhandler_base::fstat_helper (struct __stat64 *buf,
     {
       buf->st_mode |= STD_RBITS;
 
-      if (!pc.has_attribute (FILE_ATTRIBUTE_READONLY))
+      if (!pc.has_attribute (FILE_ATTRIBUTE_READONLY) && !pc.issymlink ())
        buf->st_mode |= STD_WBITS;
       /* | S_IWGRP | S_IWOTH; we don't give write to group etc */
 
index 5431f10..b654dc2 100644 (file)
@@ -100,7 +100,7 @@ fhandler_fifo::open_not_mine (int flags)
              __seterrno ();
              goto out;
            }
-         if (!DuplicateHandle (hMainProc, fh->get_handle (), hMainProc,
+         if (!DuplicateHandle (hMainProc, fh->get_output_handle (), hMainProc,
                                &r.handles[1], 0, false, DUPLICATE_SAME_ACCESS))
            {
              CloseHandle (r.handles[0]);
@@ -146,14 +146,14 @@ fhandler_fifo::open (int flags, mode_t)
     goto out;
 
   fhandler_pipe *fhs[2];
-  if (create (fhs, 0, flags, true))
+  if (create (fhs, 1, flags, true))
     {
       __seterrno ();
       res = 0;
     }
   else
     {
-      set_flags (fhs[0]->get_flags ());
+      set_flags (flags);
       set_io_handle (fhs[0]->get_handle ());
       set_output_handle (fhs[1]->get_handle ());
       guard = fhs[0]->guard;
index 1162e7b..79829e3 100644 (file)
@@ -610,6 +610,7 @@ _pinfo::commune_recv ()
                  it[0] = it[1] = NULL; /* FIXME: possibly left a handle open in child? */
                  break;
                }
+           debug_printf ("fifo found %p, %p", it[0], it[1]);
          }
 
        CloseHandle (hp);