{
  "slug": "clearerr",
  "term": "clearerr",
  "aliases": [
    "clearerr()",
    "clearerr(3)"
  ],
  "definition": "clearerr is a C standard-I/O operation that clears a stream's error and end-of-file indicators.",
  "note": "The function returns no value. With a valid stream it does not change errno; clearing stream indicators is separate from resetting that variable. [linux-status]\n\nThis is a status operation, not an output replay, a file synchronization request or a repair protocol. The pinned glibc implementation locks the stream, clears its indicators and unlocks it. Preserve the original failure before resetting state, and decide separately how the application will recover. [glibc-clearerr]\n\nIn Hesela's cross-libc probe, clearerr changed the recorded error indicator from set to clear after failed output. The underlying sink was still /dev/full, which rejects writes with ENOSPC. A cleared flag therefore did not mean that output had reached storage or that the failing condition had disappeared. [hesela-cross-libc] [linux-full]",
  "status": "shipping",
  "advantages": [],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-10-21",
  "limitations": [
    "Clearing indicators does not repair failed output or prove persistence."
  ],
  "related": [
    "ferror",
    "fwrite",
    "fflush",
    "fclose",
    "fsync"
  ],
  "citations": [
    {
      "id": "linux-status",
      "title": "Linux man-pages: ferror(3), clearerr(3) and errno",
      "url": "https://man7.org/linux/man-pages/man3/ferror.3.html",
      "accessed": "2026-10-21"
    },
    {
      "id": "glibc-clearerr",
      "title": "glibc 2.39: clearerr implementation",
      "url": "https://raw.githubusercontent.com/bminor/glibc/glibc-2.39/libio/clearerr.c",
      "accessed": "2026-10-21"
    },
    {
      "id": "linux-full",
      "title": "Linux man-pages: full(4), a device that rejects writes",
      "url": "https://man7.org/linux/man-pages/man4/full.4.html",
      "accessed": "2026-10-21"
    },
    {
      "id": "hesela-cross-libc",
      "title": "Hesela: cross-libc fwrite observations and stream error history",
      "url": "https://hesela.com/analyses/fsync-failure-retry-durability/#fwrite-libc",
      "accessed": "2026-10-21"
    }
  ]
}
