Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Jun 2009 10:58:18 GMT
From:      Jonathan Anderson <jona@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 164655 for review
Message-ID:  <200906181058.n5IAwIlT098610@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=164655

Change 164655 by jona@jona-trustedbsd-kentvm on 2009/06/18 10:58:13

	cap_open() shouldn't exit() on error

Affected files ...

.. //depot/projects/trustedbsd/capabilities/src/tools/cap/user_angel/cap.c#4 edit

Differences ...

==== //depot/projects/trustedbsd/capabilities/src/tools/cap/user_angel/cap.c#4 (text+ko) ====

@@ -42,10 +42,20 @@
 int cap_open(const char *path, int flags, cap_rights_t rights)
 {
 	int fd = open(path, flags);
-	if(fd < 0) err(EX_IOERR, "failed to open() path '%s'", path);
+	if(fd < 0)
+	{
+		char error[80 + strlen(path)];
+		sprintf(error, "failed to open() path '%s'", path);
+		perror(error);
+		return -1;
+	}
 
 	int cap = cap_new(fd, rights);
-	if(cap < 0) err(EX_SOFTWARE, "failed to create new capability");
+	if(cap < 0)
+	{
+		perror("Failed to create new capability");
+		return -1;
+	}
 
 	close(fd);
 	return cap;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906181058.n5IAwIlT098610>