[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: euidaccess
From: |
Simon Josefsson |
Subject: |
Re: euidaccess |
Date: |
Sat, 06 Mar 2010 23:09:02 +0100 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/23.1 (gnu/linux) |
Jim Meyering <address@hidden> writes:
> Bruno Haible wrote:
>>> > Thanks -- I've pushed the modified patch. Now the only license issue
>>> > within gnulib is 'euidaccess'...
>>
>>> + euidaccess: relax license to LGPLv2+
>
> Hi Bruno,
>
>> This won't help much, because 'euidaccess' depends on 'group-member', which
>> depends on 'xalloc', which is GPL. 'xalloc' is GPL and not LGPL because it
>> can call exit(), which is not appropriate for a library.
>
> Thanks for point that out.
> It looks like it won't be hard to fix group-member.c.
> Patches welcome.
How about something like this? Untested.
Note that this is not complete because group-member depends on the
getgroups module, which is also marked as GPL. That module doesn't use
xalloc, though, so if we want to fix this at all, applying the patch
below and relicensing getgroups to LGPLv2+ should be sufficient.
/Simon
diff --git a/lib/group-member.c b/lib/group-member.c
index 8aa3d8c..c8337e3 100644
--- a/lib/group-member.c
+++ b/lib/group-member.c
@@ -27,7 +27,7 @@
#include <unistd.h>
-#include "xalloc.h"
+#include "safe-alloc.h"
struct group_info
{
@@ -48,16 +48,16 @@ get_group_info (struct group_info *gi)
int n_group_slots = getgroups (0, NULL);
gid_t *group;
+ /* In case of error, the user loses. */
+
if (n_group_slots < 0)
return false;
- /* Avoid xnmalloc, as it goes awry when SIZE_MAX < n_group_slots. */
- if (xalloc_oversized (n_group_slots, sizeof *group))
- xalloc_die ();
- group = xmalloc (n_group_slots * sizeof *group);
- n_groups = getgroups (n_group_slots, group);
+ group = ALLOC_N_UNINITIALIZED(group, n_group_slots);
+ if (group == NULL)
+ return false;
- /* In case of error, the user loses. */
+ n_groups = getgroups (n_group_slots, group);
if (n_groups < 0)
{
free (group);
diff --git a/modules/group-member b/modules/group-member
index 20075dd..ee985c0 100644
--- a/modules/group-member
+++ b/modules/group-member
@@ -9,7 +9,7 @@ m4/group-member.m4
Depends-on:
extensions
getgroups
-xalloc
+safe-alloc
stdbool
configure.ac:
@@ -21,7 +21,7 @@ Include:
"group-member.h"
License:
-GPL
+LGPLv2+
Maintainer:
Jim Meyering
- Re: exitfail, (continued)
- Re: exitfail, Jim Meyering, 2010/03/04
- Re: exitfail, Simon Josefsson, 2010/03/04
- relax licenses for both exitfail and exit, Jim Meyering, 2010/03/05
- Re: relax licenses for both exitfail and exit, Simon Josefsson, 2010/03/05
- Re: relax licenses for both exitfail and exit, Jim Meyering, 2010/03/06
- Re: euidaccess, Bruno Haible, 2010/03/06
- Re: euidaccess, Jim Meyering, 2010/03/06
- Re: euidaccess, Bruno Haible, 2010/03/06
- Re: euidaccess, Jim Meyering, 2010/03/06
- Re: euidaccess, Paolo Bonzini, 2010/03/07
- Re: euidaccess,
Simon Josefsson <=
Re: exitfail, Bruno Haible, 2010/03/06