Potential open file descriptor in exists() of hotspot/agent/src/os/bsd/ps_core.c

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 9
    • Affects Version/s: None
    • Component/s: hotspot
    • b150

      bool exists(const char *fname)
      {
        int fd;
        if ((fd = open(fname, O_RDONLY)) > 0) {
          close(fd);
          return true;
        }
        return false;
      }
       
      The above code snippet could potentially leave a file descriptor open if 'fd' returns a zero.

            Assignee:
            Jini George (Inactive)
            Reporter:
            Jini George (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: