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

* dln_find.c (dln_find_1): use rb_warning and return immediately

if fname is longer than buffer.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30660 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2011-01-26 23:22:54 +00:00
parent c8e5ba0e84
commit d6eb807878
3 changed files with 23 additions and 7 deletions

View file

@ -1,3 +1,8 @@
Thu Jan 27 08:22:49 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* dln_find.c (dln_find_1): use rb_warning and return immediately
if fname is longer than buffer.
Wed Jan 26 22:57:30 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
* class.c (clone_method): add GC guard to prevent intermediate

View file

@ -15,10 +15,14 @@
#define dln_memerror rb_memerror
#define dln_exit rb_exit
#define dln_loaderror rb_loaderror
#define dln_warning rb_warning
#define dln_warning_arg
#else
#define dln_notimplement --->>> dln not implemented <<<---
#define dln_memerror abort
#define dln_exit exit
#define dln_warning fprintf
#define dln_warning_arg stderr,
static void dln_loaderror(const char *format, ...);
#endif
#include "dln.h"
@ -141,16 +145,23 @@ dln_find_1(const char *fname, const char *path, char *fbuf, size_t size,
static const char pathname_too_long[] = "openpath: pathname too long (ignored)\n\
\tDirectory \"%.*s\"%s\n\tFile \"%.*s\"%s\n";
#define PATHNAME_TOO_LONG() fprintf(stderr, pathname_too_long, \
((bp - fbuf) > 100 ? 100 : (int)(bp - fbuf)), fbuf, \
((bp - fbuf) > 100 ? "..." : ""), \
(fnlen > 100 ? 100 : (int)fnlen), fname, \
(fnlen > 100 ? "..." : ""))
#define PATHNAME_TOO_LONG() dln_warning(dln_warning_arg pathname_too_long, \
((bp - fbuf) > 100 ? 100 : (int)(bp - fbuf)), fbuf, \
((bp - fbuf) > 100 ? "..." : ""), \
(fnlen > 100 ? 100 : (int)fnlen), fname, \
(fnlen > 100 ? "..." : ""))
#define RETURN_IF(expr) if (expr) return (char *)fname;
RETURN_IF(!fname);
fnlen = strlen(fname);
if (fnlen >= size) {
dln_warning(dln_warning_arg
"openpath: pathname too long (ignored)\n\tFile \"%.*s\"%s\n",
(fnlen > 100 ? 100 : (int)fnlen), fname,
(fnlen > 100 ? "..." : ""));
return NULL;
}
#ifdef DOSISH
# ifndef CharNext
# define CharNext(p) ((p)+1)

View file

@ -1,11 +1,11 @@
#define RUBY_VERSION "1.9.3"
#define RUBY_RELEASE_DATE "2011-01-26"
#define RUBY_RELEASE_DATE "2011-01-27"
#define RUBY_PATCHLEVEL -1
#define RUBY_BRANCH_NAME "trunk"
#define RUBY_RELEASE_YEAR 2011
#define RUBY_RELEASE_MONTH 1
#define RUBY_RELEASE_DAY 26
#define RUBY_RELEASE_DAY 27
#include "ruby/version.h"