diff options
author | Mariusz Zaborski <oshogbo@FreeBSD.org> | 2018-11-04 19:24:49 +0000 |
---|---|---|
committer | Mariusz Zaborski <oshogbo@FreeBSD.org> | 2018-11-04 19:24:49 +0000 |
commit | 377421df9690cddad7f0c8cba84bd392e62a3b6c (patch) | |
tree | 8abd5aa51822658825b9055a2be48f3f3c0b7bcb /usr.bin/uniq | |
parent | eda66948fe3eb3134f19c97689f9ca55abce8565 (diff) | |
download | src-test2-377421df9690cddad7f0c8cba84bd392e62a3b6c.tar.gz src-test2-377421df9690cddad7f0c8cba84bd392e62a3b6c.zip |
capsicum: use a new capsicum helpers in tools
Use caph_{rights,ioctls,fcntls}_limit to simplify the code.
Notes
Notes:
svn path=/head/; revision=340138
Diffstat (limited to 'usr.bin/uniq')
-rw-r--r-- | usr.bin/uniq/uniq.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/usr.bin/uniq/uniq.c b/usr.bin/uniq/uniq.c index 862b7525e82a..dce2bbd82ab8 100644 --- a/usr.bin/uniq/uniq.c +++ b/usr.bin/uniq/uniq.c @@ -143,14 +143,14 @@ main (int argc, char *argv[]) if (argc > 0 && strcmp(argv[0], "-") != 0) ifp = file(ifn = argv[0], "r"); cap_rights_init(&rights, CAP_FSTAT, CAP_READ); - if (cap_rights_limit(fileno(ifp), &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(fileno(ifp), &rights) < 0) err(1, "unable to limit rights for %s", ifn); cap_rights_init(&rights, CAP_FSTAT, CAP_WRITE); if (argc > 1) ofp = file(argv[1], "w"); else cap_rights_set(&rights, CAP_IOCTL); - if (cap_rights_limit(fileno(ofp), &rights) < 0 && errno != ENOSYS) { + if (caph_rights_limit(fileno(ofp), &rights) < 0) { err(1, "unable to limit rights for %s", argc > 1 ? argv[1] : "stdout"); } @@ -159,8 +159,7 @@ main (int argc, char *argv[]) cmd = TIOCGETA; /* required by isatty(3) in printf(3) */ - if (cap_ioctls_limit(fileno(ofp), &cmd, 1) < 0 && - errno != ENOSYS) { + if (caph_ioctls_limit(fileno(ofp), &cmd, 1) < 0) { err(1, "unable to limit ioctls for %s", argc > 1 ? argv[1] : "stdout"); } |