1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* configure.in (ftruncate): check if available.

* file.c (rb_file_truncate): check if ftruncate instead of truncate.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2008-02-14 17:42:27 +00:00
parent 82f631ac57
commit 4804658649
3 changed files with 9 additions and 3 deletions

View file

@ -1,3 +1,9 @@
Fri Feb 15 02:42:25 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in (ftruncate): check if available.
* file.c (rb_file_truncate): check if ftruncate instead of truncate.
Fri Feb 15 02:40:54 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in (sigsetmask): check when signal semantics is not POSIX.

View file

@ -652,8 +652,8 @@ AC_REPLACE_FUNCS(dup2 memmove strerror strftime\
isnan finite isinf hypot acosh erf tgamma lgamma_r cbrt \
strlcpy strlcat)
AC_CHECK_FUNCS(fmod killpg wait4 waitpid fork spawnv syscall chroot fsync getcwd eaccess\
truncate chsize times utimes utimensat fcntl lockf lstat\
link symlink readlink\
truncate ftruncate chsize times utimes utimensat fcntl lockf lstat\
link symlink readlink\
setitimer setruid seteuid setreuid setresuid setproctitle socketpair\
setrgid setegid setregid setresgid issetugid pause lchown lchmod\
getpgrp setpgrp getpgid setpgid initgroups getgroups setgroups\

2
file.c
View file

@ -3173,7 +3173,7 @@ rb_file_truncate(VALUE obj, VALUE len)
rb_raise(rb_eIOError, "not opened for writing");
}
rb_io_flush(obj);
#ifdef HAVE_TRUNCATE
#ifdef HAVE_FTRUNCATE
if (ftruncate(fptr->fd, pos) < 0)
rb_sys_fail(fptr->path);
#else