Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

a failing close() may potentially clobber errno causing ESRCH check fail

Open Beginner friendly
#137 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
75/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
c

Research direction

Start with migrate_pid_to_root_cgroup() in src/process_cpuset.c and trace how the write result and errno are used around close(). Check the relevant tests or build to verify that a write failure reporting ESRCH is treated as success even if close() also fails, while other write failures remain errors.

Written by the indexing model from the issue text.

Description

In src/process_cpuset.c function migrate_pid_to_root_cgroup() there is an errno check for ESRCH that I believe is meant to check errno for a write failure. However, the close() after the write() can potentially also fail and overwrite errno which can lead to the errno != ESRCH check failing and the function returns 0 instead of -1.

        do {
                w = write(fd, buf, (size_t)n);
        } while (w < 0 && errno == EINTR);
        close(fd);

        /* ESRCH = process already gone; treat as success. */
        if (w < 0 && errno != ESRCH)
                return -1;
        return 0;
Dominant language
C
Stars
231
Forks
33
Avg merge
2m
Merged PRs (30d)
2

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from intel/intel-lpmd

All issues in intel/intel-lpmd

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.