From: prj@po.cwru.edu (Paul Jarc)
Subject: Re: setgroups
Date: Thu, 17 Apr 2003 19:20:12 -0400 [thread overview]
Message-ID: <m3of34pv7h.fsf@multivac.cwru.edu> (raw)
In-Reply-To: <87brz4dagq.fsf@raven.i.defaultvalue.org> (Rob Browning's message of "Thu, 17 Apr 2003 17:29:25 -0500")
Ok, here's a patch for setgroups. It's my first time writing Guile C
code, so someone should check it carefully. I used a vector argument
just because that's what getgroups returns.
Index: configure.in
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/configure.in,v
retrieving revision 1.213
diff -u -r1.213 configure.in
--- configure.in 7 Apr 2003 17:31:02 -0000 1.213
+++ configure.in 17 Apr 2003 23:11:05 -0000
@@ -583,7 +583,7 @@
[Define if the system supports Unix-domain (file-domain) sockets.])
fi
-AC_CHECK_FUNCS(socketpair getgroups setpwent pause tzset)
+AC_CHECK_FUNCS(socketpair getgroups setgroups setpwent pause tzset)
AC_CHECK_FUNCS(sethostent gethostent endhostent dnl
setnetent getnetent endnetent dnl
Index: libguile/posix.c
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/posix.c,v
retrieving revision 1.112
diff -u -r1.112 posix.c
--- libguile/posix.c 5 Apr 2003 19:10:22 -0000 1.112
+++ libguile/posix.c 17 Apr 2003 23:11:05 -0000
@@ -228,6 +228,36 @@
#undef FUNC_NAME
#endif
+#ifdef HAVE_SETGROUPS
+SCM_DEFINE (scm_setgroups, "setgroups", 1, 0, 0,
+ (SCM group_vec),
+ "Set the supplementary group IDs to those found in the vector\n"
+ "argument.")
+#define FUNC_NAME s_scm_setgroups
+{
+ size_t ngroups;
+ size_t size;
+ size_t i;
+ int result;
+ GETGROUPS_T *groups;
+
+ SCM_VALIDATE_VECTOR (1, group_vec);
+
+ ngroups = SCM_VECTOR_LENGTH (group_vec);
+ size = ngroups * sizeof (GETGROUPS_T);
+ groups = scm_malloc (size);
+ for(i = ngroups; i >= 0; i--)
+ groups [i] = SCM_INUM (SCM_VECTOR_REF (group_vec, i));
+
+ result = setgroups (ngroups, groups);
+ free (groups);
+ if (result < 0)
+ SCM_SYSERROR;
+ return SCM_UNSPECIFIED;
+}
+#undef FUNC_NAME
+#endif
+
#ifdef HAVE_GETPWENT
SCM_DEFINE (scm_getpwuid, "getpw", 0, 1, 0,
(SCM user),
paul
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
next prev parent reply other threads:[~2003-04-17 23:20 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <m3y928ripu.fsf@multivac.cwru.edu>
2003-04-17 22:29 ` setgroups Rob Browning
2003-04-17 22:43 ` setgroups Paul Jarc
2003-04-17 23:10 ` setgroups Marius Vollmer
2003-04-18 3:19 ` setgroups Rob Browning
2003-04-17 23:20 ` Paul Jarc [this message]
2003-04-18 3:34 ` setgroups Rob Browning
2003-04-18 10:31 ` setgroups Marius Vollmer
2003-04-18 15:37 ` setgroups Paul Jarc
2003-04-18 17:38 ` setgroups Paul Jarc
2003-04-18 17:49 ` setgroups Paul Jarc
2003-04-21 16:20 ` setgroups Paul Jarc
2003-04-18 15:41 ` setgroups Rob Browning
2003-04-18 16:00 ` setgroups Paul Jarc
2003-04-18 17:01 ` setgroups Rob Browning
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
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3of34pv7h.fsf@multivac.cwru.edu \
--to=prj@po.cwru.edu \
/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 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 read-only IMAP folder(s) and NNTP newsgroup(s).