This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


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

bugs in java/io/natFile.cc


Howdy,

When compiling on i686-pc-linux-gnu, I received the following
warning:

/home/kraai/dev/gcc/libjava/java/io/natFile.cc:230:18: warning: extra tokens at end of #ifdef directive

The offending line looks like the following:

#ifdef HAVE_STAT && HAVE_CHMOD


In addition, in the performDelete function, the errno is checked
to see if directory creation failed even if rmdir was never
called.

The following patch fixes these problems, and bootstrapped on
i686-pc-linux-gnu.  I believe that my copyright assignment should
be in order.

Matt

2001-04-30  Matt Kraai  <kraai@alumni.carnegiemellon.edu>

	java/io/natFile.cc (performSetReadOnly): Fix #ifdef test.
	(performDelete): Fix #endif placement.

Index: libjava/java/io/natFile.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/natFile.cc,v
retrieving revision 1.10
diff -c -3 -p -r1.10 natFile.cc
*** natFile.cc	2001/04/02 05:23:10	1.10
--- natFile.cc	2001/04/30 20:12:42
*************** java::io::File::performSetReadOnly (void
*** 227,233 ****
    // FIXME?
    buf[total] = '\0';
  
! #ifdef HAVE_STAT && HAVE_CHMOD
    struct stat sb;
    if (::stat (buf, &sb))
      return false;
--- 227,233 ----
    // FIXME?
    buf[total] = '\0';
  
! #if defined(HAVE_STAT) && defined(HAVE_CHMOD)
    struct stat sb;
    if (::stat (buf, &sb))
      return false;
*************** java::io::File::performDelete (void)
*** 328,335 ****
  #ifdef HAVE_RMDIR
    if (! ::rmdir (buf))
      return true;
- #endif // HAVE_RMDIR
    if (errno == ENOTDIR)
      return ::unlink (buf) == 0;
  #endif // HAVE_UNLINK
    return false;
--- 328,335 ----
  #ifdef HAVE_RMDIR
    if (! ::rmdir (buf))
      return true;
    if (errno == ENOTDIR)
+ #endif // HAVE_RMDIR
      return ::unlink (buf) == 0;
  #endif // HAVE_UNLINK
    return false;


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