Date: Sat, 8 Aug 2015 10:38:38 +0000 (UTC) From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286446 - head/usr.bin/units Message-ID: <201508081038.t78AccbQ083175@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: trasz Date: Sat Aug 8 10:38:37 2015 New Revision: 286446 URL: https://svnweb.freebsd.org/changeset/base/286446 Log: Fix interaction between libedit initialization and Capsicum in units(1). The most visible is the removal of libedit warnings about being unable to open termcap database. Reviewed by: eadler@ MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3322 Modified: head/usr.bin/units/units.c Modified: head/usr.bin/units/units.c ============================================================================== --- head/usr.bin/units/units.c Sat Aug 8 09:57:38 2015 (r286445) +++ head/usr.bin/units/units.c Sat Aug 8 10:38:37 2015 (r286446) @@ -802,10 +802,10 @@ main(int argc, char **argv) if (!readfile) readunits(NULL); - if (cap_enter() < 0 && errno != ENOSYS) - err(1, "unable to enter capability mode"); - if (optind == argc - 2) { + if (cap_enter() < 0 && errno != ENOSYS) + err(1, "unable to enter capability mode"); + havestr = argv[optind]; wantstr = argv[optind + 1]; initializeunit(&have); @@ -815,8 +815,7 @@ main(int argc, char **argv) addunit(&want, wantstr, 0, 1); completereduce(&want); showanswer(&have, &want); - } - else { + } else { inhistory = history_init(); el = el_init(argv[0], stdin, stdout, stderr); el_set(el, EL_PROMPT, &prompt); @@ -828,6 +827,9 @@ main(int argc, char **argv) if (inhistory == 0) err(1, "Could not initialize history"); + if (cap_enter() < 0 && errno != ENOSYS) + err(1, "unable to enter capability mode"); + if (!quiet) printf("%d units, %d prefixes\n", unitcount, prefixcount);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201508081038.t78AccbQ083175>