Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4130165

(io) sysAvailable on Win32 has a code path that returns without a return stmt

XMLWordPrintable

    • x86
    • windows_95

      There's a bug in function sysAvailable() in file
      src/win32/java/runtime/io_md.c, in JDK 1.1.6M.

      Note in the following listing of function sysAvailable() that no value
      is returned if the call to fstat() fails. This causes JCK test
      FISAvailableTest2 in JCK-116ea to fail on win32 systems.

      int
      sysAvailable(int fd, long *pbytes)
      {
          long cur, end;
          struct stat stbuf;

          if (fstat(fd, &stbuf) >= 0) {
              int mode = stbuf.st_mode;
              if (S_ISCHR(mode) || S_ISFIFO(mode)) {
                  return (fd == 0) ? stdinAvailable(fd, pbytes) :
                      nonSeekAvailable(fd, pbytes);
              }
              if ((cur = lseek(fd, 0L, SEEK_CUR)) == -1) {
                  return FALSE;
              } else if ((end = lseek(fd, 0L, SEEK_END)) == -1) {
                  return FALSE;
              } else if (lseek(fd, cur, SEEK_SET) == -1) {
                  return FALSE;
              }
              *pbytes = end - cur;
              return TRUE;
          }
      }

            apalanissunw Anand Palaniswamy (Inactive)
            jbenoit Jonathan Benoit (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: