mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
etc.c: try confstr on Mac OS X
* ext/etc/etc.c (etc_systmpdir): try user temporary directory by confstr() on Mac OS X. c.f. http://www.opensource.apple.com/source/ruby/ruby-104/patches/ext_etc_etc.c.diff git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9b6a8da0eb
commit
f18065f469
2 changed files with 22 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
Tue Oct 7 11:17:08 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ext/etc/etc.c (etc_systmpdir): try user temporary directory by
|
||||
confstr() on Mac OS X.
|
||||
c.f. http://www.opensource.apple.com/source/ruby/ruby-104/patches/ext_etc_etc.c.diff
|
||||
|
||||
Tue Oct 7 10:48:17 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* configure.in (struct stat.st_size): prefer off_t over int, long,
|
||||
|
|
|
@ -640,7 +640,22 @@ etc_systmpdir(void)
|
|||
if (!len) return Qnil;
|
||||
tmpdir = rb_w32_conv_from_wchar(path, rb_filesystem_encoding());
|
||||
#else
|
||||
tmpdir = rb_filesystem_str_new_cstr("/tmp");
|
||||
const char default_tmp[] = "/tmp";
|
||||
const char *tmpstr = default_tmp;
|
||||
size_t tmplen = 0;
|
||||
# if defined _CS_DARWIN_USER_TEMP_DIR
|
||||
#ifndef MAXPATHLEN
|
||||
#define MAXPATHLEN 1024
|
||||
#endif
|
||||
char path[MAXPATHLEN];
|
||||
size_t len;
|
||||
len = confstr(_CS_DARWIN_USER_TEMP_DIR, path, sizeof(path));
|
||||
if (len > 0) {
|
||||
tmpstr = path;
|
||||
tmplen = len - 1;
|
||||
}
|
||||
# endif
|
||||
tmpdir = rb_filesystem_str_new(tmpstr, tmplen);
|
||||
#endif
|
||||
FL_UNSET(tmpdir, FL_TAINT);
|
||||
return tmpdir;
|
||||
|
|
Loading…
Add table
Reference in a new issue