Re: The "Unix Philosophy 2020" document

From: Casper Ti. Vector <caspervector_at_gmail.com>
Date: Mon, 25 Nov 2019 22:20:47 +0800

On Mon, Nov 25, 2019 at 10:52:02AM +0800, Casper Ti. Vector wrote:
> Macros and/or helper functions (again cf. [1]; they can be factored into
> a mini-library in nosh) can also be used to reduce boilerplate like
> > const int error(errno);
> > std::fprintf(stderr, ..., std::strerror(error));
> > throw EXIT_FAILURE;
> which can be easily observed after the attached patch is applied.

The first chunk in the patch is incorrect, and the new code should be
(in other words, swap the `ENOENT == error' and the `const int' lines)
> if (!self_cgroup) {
> if (ENOENT == error) return; // This is what we'll see on a BSD.
> const int error(errno);
> std::fprintf(stderr, "%s: FATAL: %s: %s\n", prog, "/proc/self/cgroup", std::strerror(error));
> throw EXIT_FAILURE;
> }
I am very sorry for that.

-- 
My current OpenPGP key:
RSA4096/0x227E8CAAB7AA186C (expires: 2020.10.19)
7077 7781 B859 5166 AE07 0286 227E 8CAA B7AA 186C
Received on Mon Nov 25 2019 - 14:20:47 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:44:19 UTC