Re: SIGSEGV on fclose.

From: Alan Cox (alan@lxorguk.ukuu.org.uk)
Date: Thu Jul 13 2000 - 07:24:31 EDT

  • Next message: Norbert Federa: "How to increase the page cache size"

    > Is it difficult for Linux to spot the the file isn't open and return EBADF?
    > What does POSIX have to say about this? IMHO making it easier to port your
    > programs to Linux (and behaving a little more sanely :) is worth a couple of
    > extra bytes of anyone's kernel.

    Its very simple. If you fclose something which is not a valid fopen handle
    your program may and will break. On other platforms you should fix it too
    quite possibly you are getting away purely by luck and it may either break
    or worse yet corrupt data undetected if you dont

            close(bogusvalue)

            returns -1, EBADF

            fclose(bogusvalue)

            is entitled to do as it pleases

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.rutgers.edu
    Please read the FAQ at http://www.tux.org/lkml/



    This archive was generated by hypermail 2b29 : Thu Jul 13 2000 - 07:32:35 EDT