When compiled with gcc 4.1.2 the program below dies with SIGXFSZ on Linux.
I don't think the standard allows filebuf to report errors using signals
(since it describes file I/O in terms of C stdio), nor does a signal seem
desirable in C++.

$ cat u.cpp && g++ u.cpp && ./a.out || echo $?
#include <fstream>
#include <sys/resource.h>

int main ()
{
    rlimit rl;
    getrlimit (RLIMIT_FSIZE, &rl);

    rl.rlim_cur = 32;
    setrlimit (RLIMIT_FSIZE, &rl);

    std::filebuf fb;
    if (0 == fb.open ("testfile.text", std::ios::out))
        return -1;

    for (rlim_t i = 0; i != rl.rlim_cur + 1; ++i)
        fb.sputc ('*');

}
File size limit exceeded
153


-- 
           Summary: SIGXFSZ in filebuf
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sebor at roguewave dot com
 GCC build triplet: x86_64-redhat-linux
  GCC host triplet: x86_64-redhat-linux
GCC target triplet: x86_64-redhat-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35176

Reply via email to