summaryrefslogtreecommitdiff
path: root/dln_find.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-26 23:22:54 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-26 23:22:54 +0000
commitd6eb807878922b2976831236c3f6235ccfb6edb4 ()
tree2a846a26b262bc242b1b3bd183ece068c9f551b0 /dln_find.c
parentc8e5ba0e841e2629d282c5853fc334309f36293f (diff)
* 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
-rw-r--r--dln_find.c21
1 files changed, 16 insertions, 5 deletions
@@ -15,10 +15,14 @@
#define dln_memerror rb_memerror
#define dln_exit rb_exit
#define dln_loaderror rb_loaderror
#else
#define dln_notimplement --->>> dln not implemented <<<---
#define dln_memerror abort
#define dln_exit exit
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 RETURN_IF(expr) if (expr) return (char *)fname;
RETURN_IF(!fname);
fnlen = strlen(fname);
#ifdef DOSISH
# ifndef CharNext
# define CharNext(p) ((p)+1)