PERFORCE change 164655 for review

Jonathan Anderson jona at FreeBSD.org
Thu Jun 18 10:58:19 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=164655

Change 164655 by jona at 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;


More information about the p4-projects mailing list