From d831b039189752317a78cf8b4fc00d99727546cd Mon Sep 17 00:00:00 2001 From: Gary Houston Date: Sun, 23 Jan 2000 20:25:27 +0000 Subject: [PATCH] * filesys.c (scm_chown): omit port/fdes support if HAVE_FCHOWN is not defined (thanks to Richard Y. Kim). --- ChangeLog | 4 ++++ THANKS | 1 + configure.in | 2 +- libguile/ChangeLog | 5 +++++ libguile/filesys.c | 23 ++++++++++++----------- 5 files changed, 23 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index de2969fac..73636bbf4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2000-01-23 Gary Houston + + * configure.in: check for fchown. + Tue Jan 18 12:55:15 2000 Mikael Djurfeldt * acinclude.m4 (AC_LIBLTDL_CONVENIENCE): Add $(top_srcdir)/libltdl diff --git a/THANKS b/THANKS index be3adba0d..9639314c4 100644 --- a/THANKS +++ b/THANKS @@ -15,6 +15,7 @@ For fixes or providing information which led to a fix: Mark Galassi Greg Harvey Dirk Herrmann + Richard Kim Brad Knotwell Eric Moore Roland Orre diff --git a/configure.in b/configure.in index 35a06fc4b..b17b2d961 100644 --- a/configure.in +++ b/configure.in @@ -163,7 +163,7 @@ AC_SUBST(INCLTDL) AC_SUBST(LIBLTDL) AC_SUBST(DLPREOPEN) -AC_CHECK_FUNCS(ctermid ftime getcwd geteuid gettimeofday lstat mkdir mknod nice readlink rename rmdir select setegid seteuid setlocale setpgid setsid sigaction siginterrupt strftime strptime symlink sync tcgetpgrp tcsetpgrp times uname waitpid bzero strdup system usleep atexit on_exit) +AC_CHECK_FUNCS(ctermid ftime fchown getcwd geteuid gettimeofday lstat mkdir mknod nice readlink rename rmdir select setegid seteuid setlocale setpgid setsid sigaction siginterrupt strftime strptime symlink sync tcgetpgrp tcsetpgrp times uname waitpid bzero strdup system usleep atexit on_exit) ### Some systems don't declare some functions. On such systems, we ### need to at least provide our own K&R-style declarations. diff --git a/libguile/ChangeLog b/libguile/ChangeLog index abb5871b4..57ee72b4c 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,8 @@ +2000-01-23 Gary Houston + + * filesys.c (scm_chown): omit port/fdes support if HAVE_FCHOWN is + not defined (thanks to Richard Y. Kim). + Thu Jan 20 13:00:38 2000 Greg J. Badros * Makefile.in: Removed, this is auto-generated. diff --git a/libguile/filesys.c b/libguile/filesys.c index b1c6c9375..b9552b9f3 100644 --- a/libguile/filesys.c +++ b/libguile/filesys.c @@ -124,13 +124,13 @@ SCM_DEFINE (scm_chown, "chown", 3, 0, 0, (SCM object, SCM owner, SCM group), - "Change the ownership and group of the file referred to by @var{obj} to\n" - "the integer userid values @var{owner} and @var{group}. @var{obj} can be\n" - "a string containing a file name or a port or integer file descriptor\n" - "which is open on the file (in which case fchown is used as the underlying\n" - "system call). The return value\n" + "Change the ownership and group of the file referred to by @var{object} to\n" + "the integer values @var{owner} and @var{group}. @var{object} can be\n" + "a string containing a file name or, if the platform\n" + "supports fchown, a port or integer file descriptor\n" + "which is open on the file. The return value\n" "is unspecified.\n\n" - "If @var{obj} is a symbolic link, either the\n" + "If @var{object} is a symbolic link, either the\n" "ownership of the link or the ownership of the referenced file will be\n" "changed depending on the operating system (lchown is\n" "unsupported at present). If @var{owner} or @var{group} is specified\n" @@ -138,21 +138,21 @@ SCM_DEFINE (scm_chown, "chown", 3, 0, 0, #define FUNC_NAME s_scm_chown { int rv; - int fdes; object = SCM_COERCE_OUTPORT (object); SCM_VALIDATE_INUM (2,owner); SCM_VALIDATE_INUM (3,group); +#ifdef HAVE_FCHOWN if (SCM_INUMP (object) || (SCM_OPFPORTP (object))) { - if (SCM_INUMP (object)) - fdes = SCM_INUM (object); - else - fdes = SCM_FPORT_FDES (object); + int fdes = SCM_INUMP (object) ? SCM_INUM (object) + : SCM_FPORT_FDES (object); + SCM_SYSCALL (rv = fchown (fdes, SCM_INUM (owner), SCM_INUM (group))); } else +#endif { SCM_VALIDATE_ROSTRING(1,object); SCM_COERCE_SUBSTR (object); @@ -821,6 +821,7 @@ static int set_element (SELECT_TYPE *set, SCM element, int arg) { int fd; + element = SCM_COERCE_OUTPORT (element); if (SCM_OPFPORTP (element)) fd = SCM_FPORT_FDES (element);