From: <ew...@us...> - 2007-06-20 16:56:18
|
Revision: 2477 http://svn.sourceforge.net/selinux/?rev=2477&view=rev Author: ewalsh Date: 2007-06-20 09:56:16 -0700 (Wed, 20 Jun 2007) Log Message: ----------- Author: Eamon Walsh Email: ew...@ty... Subject: libsepol: sepol_check_context correct error handling behavior Date: Mon, 18 Jun 2007 14:13:30 -0400 Sets errno to EINVAL, EEXIST as appropriate. Also fixed man page. Signed-off-by: Eamon Walsh <ew...@ty...> Acked-by: Stephen Smalley <sd...@ty...> Modified Paths: -------------- trunk/libsepol/man/man3/sepol_check_context.3 trunk/libsepol/src/context.c trunk/libsepol/src/context_record.c trunk/libsepol/src/sidtab.c Modified: trunk/libsepol/man/man3/sepol_check_context.3 =================================================================== --- trunk/libsepol/man/man3/sepol_check_context.3 2007-06-13 12:47:40 UTC (rev 2476) +++ trunk/libsepol/man/man3/sepol_check_context.3 2007-06-20 16:56:16 UTC (rev 2477) @@ -22,4 +22,4 @@ from libselinux instead. .SH "RETURN VALUE" -Returns 0 on success or -EINVAL otherwise. +Returns 0 on success or -1 with errno set otherwise. Modified: trunk/libsepol/src/context.c =================================================================== --- trunk/libsepol/src/context.c 2007-06-13 12:47:40 UTC (rev 2476) +++ trunk/libsepol/src/context.c 2007-06-20 16:56:16 UTC (rev 2477) @@ -224,6 +224,7 @@ return STATUS_SUCCESS; err_destroy: + errno = EINVAL; context_destroy(scontext); err: Modified: trunk/libsepol/src/context_record.c =================================================================== --- trunk/libsepol/src/context_record.c 2007-06-13 12:47:40 UTC (rev 2476) +++ trunk/libsepol/src/context_record.c 2007-06-20 16:56:16 UTC (rev 2477) @@ -1,3 +1,4 @@ +#include <errno.h> #include <stdlib.h> #include <string.h> #include <stdio.h> @@ -260,6 +261,7 @@ return STATUS_SUCCESS; mcontext: + errno = EINVAL; ERR(handle, "malformed context \"%s\"", str); err: Modified: trunk/libsepol/src/sidtab.c =================================================================== --- trunk/libsepol/src/sidtab.c 2007-06-13 12:47:40 UTC (rev 2476) +++ trunk/libsepol/src/sidtab.c 2007-06-20 16:56:16 UTC (rev 2477) @@ -56,8 +56,10 @@ cur = cur->next; } - if (cur && sid == cur->sid) + if (cur && sid == cur->sid) { + errno = EEXIST; return -EEXIST; + } newnode = (sidtab_node_t *) malloc(sizeof(sidtab_node_t)); if (newnode == NULL) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |