summaryrefslogtreecommitdiffstats
path: root/posix.c
diff options
context:
space:
mode:
authorDavid N. Welton <davidw@efn.org>1998-12-11 20:21:49 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:25 -0800
commita47af30d2f0e96afcd1f14b1984575c359faa3d6 (patch)
tree2ed08ce2d757f917de7c3c7c04fd7e309f454c83 /posix.c
parentf64b2806c1d66a1341bb8b1491f384169ab1d65f (diff)
parentdb04688faa20f3576257c0fe41752ec435beab9a (diff)
downloadscm-a47af30d2f0e96afcd1f14b1984575c359faa3d6.tar.gz
scm-a47af30d2f0e96afcd1f14b1984575c359faa3d6.zip
Import Debian changes 5c3-5debian/5c3-5
scm (5c3-5) frozen unstable; urgency=low * debian/rules chmod +x's bld.scm. Fixes #30521. scm (5c3-4) frozen unstable; urgency=low * Made bld.scm executable. Fixes #29578. scm (5c3-3) frozen unstable; urgency=low * -nw * Fixes #16762. * Fixes #18163. * Fixes #18164. * Fixes #23743. * Fixes #24098. * Fixes #24099. * Fixes #24547. scm (5c3-2) frozen unstable; urgency=low * Re-uploading for slink freeze. scm (5c3-1) unstable; urgency=low * New upstream version.
Diffstat (limited to 'posix.c')
-rw-r--r--posix.c43
1 files changed, 18 insertions, 25 deletions
diff --git a/posix.c b/posix.c
index 77cfaf4..1ed5f1c 100644
--- a/posix.c
+++ b/posix.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1994, 1995, 1998 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -57,6 +57,10 @@
#else /* added by Denys Duchier */
# ifdef SVR4
# include <unistd.h>
+# else
+# ifdef linux
+# include <unistd.h>
+# endif
# endif
#endif
@@ -134,16 +138,6 @@ SCM open_pipe(pipestr, modes)
ALLOW_INTS;
return z;
}
-SCM l_open_input_pipe(pipestr)
- SCM pipestr;
-{
- return open_pipe(pipestr, makfromstr("r", (sizeof "r")-1));
-}
-SCM l_open_output_pipe(pipestr)
- SCM pipestr;
-{
- return open_pipe(pipestr, makfromstr("w", (sizeof "w")-1));
-}
static int prinpipe(exp, port, writing)
SCM exp; SCM port; int writing;
{
@@ -155,25 +149,22 @@ static char scm_s_getgroups[] = "getgroups";
SCM scm_getgroups()
{
SCM grps, ans;
- int ngroups = getgroups(NULL, 0);
+ int ngroups = getgroups(0, 0);
if (!ngroups) return BOOL_F;
NEWCELL(grps);
DEFER_INTS;
+ /* grps is used as a gc protect, its type used to be tc7_string, but
+ strings are now checked for null termination during gc. */
+ grps = must_malloc_cell(ngroups * sizeof(gid_t), scm_s_getgroups);
+ /* length need not be exactly right */
+ SETLENGTH(grps, (0L + ngroups * sizeof(gid_t))/sizeof(long), tc7_uvect);
+ ALLOW_INTS;
{
- gid_t *groups = (gid_t *)must_malloc(ngroups * sizeof(gid_t),
- scm_s_getgroups);
+ gid_t *groups = (gid_t *)CHARS(grps);
int val = getgroups(ngroups, groups);
- if (val < 0) {
- must_free((char *)groups);
- ALLOW_INTS;
- return BOOL_F;
- }
- SETCHARS(grps, groups); /* set up grps as a GC protect */
- SETLENGTH(grps, 0L + ngroups * sizeof(gid_t), tc7_string);
- ALLOW_INTS;
+ if (val < 0) return BOOL_F;
ans = make_vector(MAKINUM(ngroups), UNDEFINED);
while (--ngroups >= 0) VELTS(ans)[ngroups] = MAKINUM(groups[ngroups]);
- SETCHARS(grps, groups); /* to make sure grps stays around. */
return ans;
}
}
@@ -383,8 +374,6 @@ static iproc subr1s[] = {
{"setegid", l_setegid},
{"seteuid", l_seteuid},
#endif
- {"open-input-pipe", l_open_input_pipe},
- {"open-output-pipe", l_open_output_pipe},
{s_ttyname, l_ttyname},
{0, 0}};
@@ -411,4 +400,8 @@ void init_posix()
ptobs[0x0ff & (tc16_pipe>>8)].free = pclose;
ptobs[0x0ff & (tc16_pipe>>8)].print = prinpipe;
add_feature(s_pipe);
+ scm_ldstr("\n\
+(define (open-input-pipe cmd) (open-pipe cmd \"r\"))\n\
+(define (open-output-pipe cmd) (open-pipe cmd \"w\"))\n\
+");
}