unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Rob Browning <rlb@defaultvalue.org>
Subject: Re: setgroups
Date: Thu, 17 Apr 2003 22:34:13 -0500	[thread overview]
Message-ID: <87u1cwcwcq.fsf@raven.i.defaultvalue.org> (raw)
In-Reply-To: <m3of34pv7h.fsf@multivac.cwru.edu> (prj@po.cwru.edu's message of "Thu, 17 Apr 2003 19:20:12 -0400")

prj@po.cwru.edu (Paul Jarc) writes:

> 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.

That sounds about right...

> +  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);

I might add a 

     scm_remember_upto_here_1 (group_vec);

here just to be safe, but that might be overkill, depending on what
SCM_VECTOR_REF does.

> +  if (result < 0)
> +    SCM_SYSERROR;
> +  return SCM_UNSPECIFIED;
> +}

Overall, it looks good to me.

-- 
Rob Browning
rlb @defaultvalue.org, @linuxdevel.com, and @debian.org
Previously @cs.utexas.edu
GPG starting 2002-11-03 = 14DD 432F AE39 534D B592  F9A0 25C8 D377 8C7E 73A4


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


  reply	other threads:[~2003-04-18  3:34 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   ` setgroups Paul Jarc
2003-04-18  3:34     ` Rob Browning [this message]
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=87u1cwcwcq.fsf@raven.i.defaultvalue.org \
    --to=rlb@defaultvalue.org \
    /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).