mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Brent Cook <bcook@openbsd.org>
To: musl@lists.openwall.com
Cc: Brent Cook <bcook@openbsd.org>
Subject: [PATCH] implement issetugid(2)
Date: Sat, 12 Jul 2014 11:55:06 -0600	[thread overview]
Message-ID: <1405187706-27171-1-git-send-email-bcook@openbsd.org> (raw)

From OpenBSD 2.0 and later
http://www.openbsd.org/cgi-bin/man.cgi?query=issetugid&sektion=2
---
 include/unistd.h       | 1 +
 src/unistd/issetugid.c | 9 +++++++++
 2 files changed, 10 insertions(+)
 create mode 100644 src/unistd/issetugid.c

diff --git a/include/unistd.h b/include/unistd.h
index bb19cd8..30290c3 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -109,6 +109,7 @@ uid_t geteuid(void);
 gid_t getgid(void);
 gid_t getegid(void);
 int getgroups(int, gid_t []);
+int issetugid(void);
 int setuid(uid_t);
 int setreuid(uid_t, uid_t);
 int seteuid(uid_t);
diff --git a/src/unistd/issetugid.c b/src/unistd/issetugid.c
new file mode 100644
index 0000000..8c81336
--- /dev/null
+++ b/src/unistd/issetugid.c
@@ -0,0 +1,9 @@
+#include <errno.h>
+#include <unistd.h>
+#include <sys/auxv.h>
+
+int issetugid(void)
+{
+	errno = 0;
+	return !(getauxval(AT_SECURE) == 0 && errno != ENOENT);
+}
--
1.9.1



             reply	other threads:[~2014-07-12 17:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-12 17:55 Brent Cook [this message]
2014-07-12 19:20 ` Rich Felker
2014-07-12 22:18   ` Brent Cook
2014-07-12 23:32     ` Isaac Dunham
2014-07-12 20:12 ` Isaac Dunham
2014-07-12 21:23   ` Brent Cook
2014-07-13 10:39     ` Szabolcs Nagy
2014-07-12 23:54 Brent Cook
2014-07-15  0:57 ` Brent Cook
2014-07-15  0:59   ` Brent Cook
2014-07-15  2:06   ` Brent Cook
2014-07-15  2:40 ` Isaac Dunham
2014-07-15  4:31   ` Rich Felker
2014-07-15 15:54   ` Brent Cook

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=1405187706-27171-1-git-send-email-bcook@openbsd.org \
    --to=bcook@openbsd.org \
    --cc=musl@lists.openwall.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).