svn commit: r336307 - in head/usr.sbin: fstyp uefisign

Mariusz Zaborski oshogbo at FreeBSD.org
Sun Jul 15 17:21:20 UTC 2018


Author: oshogbo
Date: Sun Jul 15 17:21:19 2018
New Revision: 336307
URL: https://svnweb.freebsd.org/changeset/base/336307

Log:
  Use capsicum helpers in fstype and ctld.
  
  Reviewed by:	trasz

Modified:
  head/usr.sbin/fstyp/fstyp.c
  head/usr.sbin/uefisign/child.c

Modified: head/usr.sbin/fstyp/fstyp.c
==============================================================================
--- head/usr.sbin/fstyp/fstyp.c	Sun Jul 15 17:10:12 2018	(r336306)
+++ head/usr.sbin/fstyp/fstyp.c	Sun Jul 15 17:21:19 2018	(r336307)
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/disk.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
+#include <capsicum_helpers.h>
 #include <err.h>
 #include <errno.h>
 #include <stdbool.h>
@@ -191,8 +192,7 @@ main(int argc, char **argv)
 	if (fp == NULL)
 		err(1, "%s", path);
 
-	error = cap_enter();
-	if (error != 0 && errno != ENOSYS)
+	if (caph_enter() < 0)
 		err(1, "cap_enter");
 
 	if (ignore_type == false)

Modified: head/usr.sbin/uefisign/child.c
==============================================================================
--- head/usr.sbin/uefisign/child.c	Sun Jul 15 17:10:12 2018	(r336306)
+++ head/usr.sbin/uefisign/child.c	Sun Jul 15 17:21:19 2018	(r336307)
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <assert.h>
+#include <capsicum_helpers.h>
 #include <err.h>
 #include <errno.h>
 #include <stdio.h>
@@ -228,7 +229,6 @@ int
 child(const char *inpath, const char *outpath, int pipefd,
     bool Vflag, bool vflag)
 {
-	int error;
 	FILE *outfp = NULL, *infp = NULL;
 	struct executable *x;
 
@@ -236,8 +236,7 @@ child(const char *inpath, const char *outpath, int pip
 	if (outpath != NULL)
 		outfp = checked_fopen(outpath, "w");
 
-	error = cap_enter();
-	if (error != 0 && errno != ENOSYS)
+	if (caph_enter() < 0)
 		err(1, "cap_enter");
 
 	x = calloc(1, sizeof(*x));


More information about the svn-src-all mailing list