This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: Avoid using S_IRGRP, etc., on Windows


Windows doesn't define all of the permissions macros (e.g., S_IRGRP)
because its filesystems don't have that concept.  This patch checks
that the macros are defined before trying to use them.

OK?

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

2005-03-09  Mark Mitchell  <mark@codesourcery.com>

	* remote-fileo.c (remote_fileio_mode_to_host): Accomodate lack of
	S_IRGRP and related macros.
	(remote_fileio_mode_to_target): Likewise.

Index: remote-fileio.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-fileio.c,v
retrieving revision 1.12
diff -c -5 -p -r1.12 remote-fileio.c
*** remote-fileio.c	14 Feb 2005 18:10:10 -0000	1.12
--- remote-fileio.c	9 Mar 2005 19:15:32 -0000
*************** remote_fileio_mode_to_host (long mode, i
*** 160,181 ****
--- 160,191 ----
      hmode |= S_IRUSR;
    if (mode & FILEIO_S_IWUSR)
      hmode |= S_IWUSR;
    if (mode & FILEIO_S_IXUSR)
      hmode |= S_IXUSR;
+ #ifdef S_IRGRP
    if (mode & FILEIO_S_IRGRP)
      hmode |= S_IRGRP;
+ #endif
+ #ifdef S_IWGRP
    if (mode & FILEIO_S_IWGRP)
      hmode |= S_IWGRP;
+ #endif
+ #ifdef S_IXGRP
    if (mode & FILEIO_S_IXGRP)
      hmode |= S_IXGRP;
+ #endif
    if (mode & FILEIO_S_IROTH)
      hmode |= S_IROTH;
+ #ifdef S_IWOTH
    if (mode & FILEIO_S_IWOTH)
      hmode |= S_IWOTH;
+ #endif
+ #ifdef S_IXOTH
    if (mode & FILEIO_S_IXOTH)
      hmode |= S_IXOTH;
+ #endif
    return hmode;
  }
  
  static LONGEST
  remote_fileio_mode_to_target (mode_t mode)
*************** remote_fileio_mode_to_target (mode_t mod
*** 192,213 ****
--- 202,233 ----
      tmode |= FILEIO_S_IRUSR;
    if (mode & S_IWUSR)
      tmode |= FILEIO_S_IWUSR;
    if (mode & S_IXUSR)
      tmode |= FILEIO_S_IXUSR;
+ #ifdef S_IRGRP
    if (mode & S_IRGRP)
      tmode |= FILEIO_S_IRGRP;
+ #endif
+ #ifdef S_IWRGRP
    if (mode & S_IWGRP)
      tmode |= FILEIO_S_IWGRP;
+ #endif
+ #ifdef S_IXGRP
    if (mode & S_IXGRP)
      tmode |= FILEIO_S_IXGRP;
+ #endif
    if (mode & S_IROTH)
      tmode |= FILEIO_S_IROTH;
+ #ifdef S_IWOTH
    if (mode & S_IWOTH)
      tmode |= FILEIO_S_IWOTH;
+ #endif
+ #ifdef S_IXOTH
    if (mode & S_IXOTH)
      tmode |= FILEIO_S_IXOTH;
+ #endif
    return tmode;
  }
  
  static int
  remote_fileio_errno_to_target (int error)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]