All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel J Walsh <dwalsh@redhat.com>
To: SELinux <selinux@tycho.nsa.gov>
Subject: Patch to context_new to set errno to EINVAL on bad values
Date: Wed, 24 Mar 2010 09:17:03 -0400	[thread overview]
Message-ID: <4BAA10CF.4080206@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: libselinux_context_new.patch --]
[-- Type: text/plain, Size: 577 bytes --]

diff --git a/libselinux/src/context.c b/libselinux/src/context.c
index 8164104..b673733 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;
 }

             reply	other threads:[~2010-03-24 13:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-24 13:17 Daniel J Walsh [this message]
2010-03-24 18:28 ` Patch to context_new to set errno to EINVAL on bad values Joshua Brindle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BAA10CF.4080206@redhat.com \
    --to=dwalsh@redhat.com \
    --cc=selinux@tycho.nsa.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.