From: Sebastien Marie Subject: Re: Redundant pledge(2) call in dmesg To: Kyle Ackerman , "tech@openbsd.org" Date: Thu, 21 Nov 2024 07:13:27 +0100 Kyle Ackerman writes: > There is a redundant call to pledge(2) in dmesg.c > > diff /usr/src > commit - 61e9d0de7a4c2cb6906206c99b245d89b1ad9d87 > path + /usr/src > blob - 29fb0a8032dad8c4250366ad4146bf55fca3f9d0 > file + sbin/dmesg/dmesg.c > --- sbin/dmesg/dmesg.c > +++ sbin/dmesg/dmesg.c > @@ -128,9 +128,6 @@ main(int argc, char *argv[]) > "dmesg")) == NULL) > return (1); > > - if (pledge("stdio", NULL) == -1) > - err(1, "pledge"); > - > if (kvm_nlist(kd, nl) == -1) > errx(1, "kvm_nlist: %s", kvm_geterr(kd)); > if (nl[X_MSGBUF].n_type == 0) > > > Regardless if NOKVM is defined or not, the pledge call will remain. > Both pledge(2) calls are in different if branch. if (memf == NULL && nlistf == NULL) { // ... if (pledge("stdio", NULL) == -1) err(1, "pledge"); // ... } else { #ifndef NOKVM // ... if (pledge("stdio", NULL) == -1) err(1, "pledge"); // ... #endif } So both are need. Regards. -- Sebastien Marie