1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-12 06:41:13 +02:00

add check for fchmod

* configure.ac: Add a check for fchmod.

* libguile/filesys.c (scm_chmod): Guard the fchmod case with
  HAVE_FCHMOD.
This commit is contained in:
Andy Wingo 2012-07-06 11:01:51 +02:00
parent fc30e14ffe
commit 5558cdaa30
2 changed files with 4 additions and 3 deletions

View file

@ -756,7 +756,7 @@ AC_CHECK_HEADERS([assert.h crt_externs.h])
# utimensat: posix.1-2008 # utimensat: posix.1-2008
# sched_getaffinity, sched_setaffinity: GNU extensions (glibc) # sched_getaffinity, sched_setaffinity: GNU extensions (glibc)
# #
AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 ctermid fesetround ftime ftruncate fchown getcwd geteuid getsid gettimeofday gmtime_r ioctl lstat mkdir mknod nice pipe _pipe poll readdir_r readdir64_r readlink rename rmdir select setegid seteuid setlocale setpgid setsid sigaction siginterrupt stat64 strftime strptime symlink sync sysconf tcgetpgrp tcsetpgrp times uname waitpid strdup system usleep atexit on_exit chown link fcntl ttyname getpwent getgrent kill getppid getpgrp fork setitimer getitimer strchr strcmp index bcopy memcpy rindex truncate unsetenv isblank _NSGetEnviron strcoll strcoll_l newlocale utimensat sched_getaffinity sched_setaffinity]) AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 ctermid fesetround ftime ftruncate fchown fchmod getcwd geteuid getsid gettimeofday gmtime_r ioctl lstat mkdir mknod nice pipe _pipe poll readdir_r readdir64_r readlink rename rmdir select setegid seteuid setlocale setpgid setsid sigaction siginterrupt stat64 strftime strptime symlink sync sysconf tcgetpgrp tcsetpgrp times uname waitpid strdup system usleep atexit on_exit chown link fcntl ttyname getpwent getgrent kill getppid getpgrp fork setitimer getitimer strchr strcmp index bcopy memcpy rindex truncate unsetenv isblank _NSGetEnviron strcoll strcoll_l newlocale utimensat sched_getaffinity sched_setaffinity])
# Reasons for testing: # Reasons for testing:
# netdb.h - not in mingw # netdb.h - not in mingw

View file

@ -104,7 +104,6 @@
/* Some more definitions for the native Windows port. */ /* Some more definitions for the native Windows port. */
#ifdef __MINGW32__ #ifdef __MINGW32__
# define fsync(fd) _commit (fd) # define fsync(fd) _commit (fd)
# define fchmod(fd, mode) (-1)
#endif /* __MINGW32__ */ #endif /* __MINGW32__ */
@ -1335,12 +1334,13 @@ SCM_DEFINE (scm_chmod, "chmod", 2, 0, 0,
#define FUNC_NAME s_scm_chmod #define FUNC_NAME s_scm_chmod
{ {
int rv; int rv;
int fdes;
object = SCM_COERCE_OUTPORT (object); object = SCM_COERCE_OUTPORT (object);
#if HAVE_FCHMOD
if (scm_is_integer (object) || SCM_OPFPORTP (object)) if (scm_is_integer (object) || SCM_OPFPORTP (object))
{ {
int fdes;
if (scm_is_integer (object)) if (scm_is_integer (object))
fdes = scm_to_int (object); fdes = scm_to_int (object);
else else
@ -1348,6 +1348,7 @@ SCM_DEFINE (scm_chmod, "chmod", 2, 0, 0,
SCM_SYSCALL (rv = fchmod (fdes, scm_to_int (mode))); SCM_SYSCALL (rv = fchmod (fdes, scm_to_int (mode)));
} }
else else
#endif
{ {
STRING_SYSCALL (object, c_object, STRING_SYSCALL (object, c_object,
rv = chmod (c_object, scm_to_int (mode))); rv = chmod (c_object, scm_to_int (mode)));