diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2010-03-24 09:17:03 -0400 |
---|---|---|
committer | Joshua Brindle <method@manicmethod.com> | 2010-03-24 14:15:40 -0400 |
commit | 7dcf27a7916db8172db015439ded5b914da25bc1 (patch) | |
tree | b70e607607983ddd17cbb224f7cff962719243d5 | |
parent | d57ea2c2c086b711c6272dfbbfd3244a29287d8d (diff) | |
download | android_external_selinux-7dcf27a7916db8172db015439ded5b914da25bc1.tar.gz android_external_selinux-7dcf27a7916db8172db015439ded5b914da25bc1.tar.bz2 android_external_selinux-7dcf27a7916db8172db015439ded5b914da25bc1.zip |
Patch to context_new to set errno to EINVAL on bad values
Signed-off-by: Joshua Brindle <method@manicmethod.com>
-rw-r--r-- | libselinux/src/context.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libselinux/src/context.c b/libselinux/src/context.c index 81641041..b673733e 100644 --- a/libselinux/src/context.c +++ b/libselinux/src/context.c @@ -22,6 +22,7 @@ typedef struct { context_t context_new(const char *str) { int i, count; + errno = 0; context_private_t *n = (context_private_t *) malloc(sizeof(context_private_t)); context_t result = (context_t) malloc(sizeof(context_s_t)); @@ -76,6 +77,7 @@ context_t context_new(const char *str) } return result; err: + if (errno == 0) errno = EINVAL; context_free(result); return 0; } |