Re: [hackers] [ii] use pledge by default if compiled on openbsc and provide errno string || Nico Golde

From: Ali H. Fardan <raiz_AT_firemail.cc>
Date: Tue, 06 Sep 2016 21:17:17 +0300

eprint() is not declared in ii, be careful.

Raiz

diff --git a/ii.c b/ii.c
index a32326d..51318aa 100644
--- a/ii.c
+++ b/ii.c
_AT_@ -493,7 +493,7 @@ int main(int argc, char *argv[]) {

          #ifdef __OpenBSD__ /* OpenBSD pledge(2) support */
                  if (pledge("stdio rpath wpath cpath dpath", NULL) == -1) {
- eprint("ii pledge:");
+ fprintf(stderr, "ii pledge: %s\n", strerror(errno));
                          exit(EXIT_FAILURE);
                  }
          #endif

On 2016-09-06 20:58, git_AT_suckless.org wrote:
> commit 584290f2642eeacbe1b24e7174e49139d6787252
> Author: Nico Golde <nico_AT_ngolde.de>
> AuthorDate: Tue Sep 6 19:58:28 2016 +0200
> Commit: Nico Golde <nico_AT_ngolde.de>
> CommitDate: Tue Sep 6 19:58:28 2016 +0200
>
> use pledge by default if compiled on openbsc and provide errno
> string
>
> diff --git a/config.mk b/config.mk
> index 2cf103e..b5bc34f 100644
> --- a/config.mk
> +++ b/config.mk
> _AT_@ -26,5 +26,3 @@ CC = cc
> CFLAGS = -g -O0 -W -Wall ${INCLUDES} -DVERSION=\"${VERSION}\"
> LDFLAGS = ${LIBS}
>
> -# OpenBSD pledge(2) support
> -# CFLAGS+= -DUSE_PLEDGE
> diff --git a/ii.c b/ii.c
> index 3c6c3c7..a32326d 100644
> --- a/ii.c
> +++ b/ii.c
> _AT_@ -491,9 +491,9 @@ int main(int argc, char *argv[]) {
> }
> irc = tcpopen(port);
>
> - #ifdef USE_PLEDGE /* OpenBSD pledge(2) support */
> + #ifdef __OpenBSD__ /* OpenBSD pledge(2) support */
> if (pledge("stdio rpath wpath cpath dpath", NULL) == -1) {
> - fputs("ii: pledge\n", stderr);
> + eprint("ii pledge:");
> exit(EXIT_FAILURE);
> }
> #endif
Received on Tue Sep 06 2016 - 20:17:17 CEST

This archive was generated by hypermail 2.3.0 : Tue Sep 06 2016 - 20:24:15 CEST