summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-03-12 11:19:22 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-03-12 11:19:22 +0000
commit21410f4dfeee36f9dbadc611492516ebf2a427fa (patch)
tree3d3a19eed5242acb8d8a6c8a31b250c1680bff2c /ruby.c
parent0d8a0904d93e9600ccd095eabd5e4165c15987ff (diff)
* configure.in (rb_cv_noreturn): default for platforms not support
prototypes. * ruby.c (ruby_init_loadpath): buffer for path name should have MAXPATHLEN. * lib/mkmf.rb (configuration): include topdir and hdrdir in VPATH. * lib/mkmf.rb (create_makefile): default dependency rule. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5942 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/ruby.c b/ruby.c
index b9c29fe821..fc727d188e 100644
--- a/ruby.c
+++ b/ruby.c
@@ -33,6 +33,12 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
+#ifdef HAVE_SYS_PARAM_H
+# include <sys/param.h>
+#endif
+#ifndef MAXPATHLEN
+# define MAXPATHLEN 1024
+#endif
#ifndef HAVE_STRING_H
char *strchr _((const char*,const char));
@@ -236,7 +242,7 @@ void
ruby_init_loadpath()
{
#if defined LOAD_RELATIVE
- char libpath[FILENAME_MAX+1];
+ char libpath[MAXPATHLEN+1];
char *p;
int rest;
#if defined _WIN32 || defined __CYGWIN__
@@ -251,15 +257,15 @@ ruby_init_loadpath()
GetModuleFileName(libruby, libpath, sizeof libpath);
#elif defined(DJGPP)
extern char *__dos_argv0;
- strncpy(libpath, __dos_argv0, FILENAME_MAX);
+ strncpy(libpath, __dos_argv0, sizeof(libpath) - 1);
#elif defined(__human68k__)
extern char **_argv;
- strncpy(libpath, _argv[0], FILENAME_MAX);
+ strncpy(libpath, _argv[0], sizeof(libpath) - 1);
#elif defined(__EMX__)
- _execname(libpath, FILENAME_MAX);
+ _execname(libpath, sizeof(libpath) - 1);
#endif
- libpath[FILENAME_MAX] = '\0';
+ libpath[sizeof(libpath) - 1] = '\0';
#if defined DOSISH || defined __CYGWIN__
translate_char(libpath, '\\', '/');
#endif
@@ -276,7 +282,7 @@ ruby_init_loadpath()
p = libpath + 1;
}
- rest = FILENAME_MAX - (p - libpath);
+ rest = sizeof(libpath) - 1 - (p - libpath);
#define RUBY_RELATIVE(path) (strncpy(p, (path), rest), libpath)
#else