summaryrefslogtreecommitdiff
path: root/dln.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-13 12:00:04 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-13 12:00:04 +0000
commitd5a60df399386d52a557be7ebca572d8eb0f70ed (patch)
treee16832b11aff6b5cb32cbc40d98f5003c9bac547 /dln.c
parentd202fd4f97f6f871887cb9c92cf3cc3b39175434 (diff)
* dln.c (dln_find_1): compare fspace in size_t world.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dln.c')
-rw-r--r--dln.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/dln.c b/dln.c
index b63cbc7140..023df69016 100644
--- a/dln.c
+++ b/dln.c
@@ -1616,8 +1616,9 @@ dln_find_1(const char *fname, const char *path, char *fbuf, size_t size,
home = getenv("HOME");
if (home != NULL) {
i = strlen(home);
- if ((fspace -= i) < 0)
+ if (fspace < i)
goto toolong;
+ fspace -= i;
memcpy(bp, home, i);
bp += i;
}
@@ -1625,8 +1626,9 @@ dln_find_1(const char *fname, const char *path, char *fbuf, size_t size,
l--;
}
if (l > 0) {
- if ((fspace -= l) < 0)
+ if (fspace < l)
goto toolong;
+ fspace -= l;
memcpy(bp, dp, l);
bp += l;
}
@@ -1638,7 +1640,7 @@ dln_find_1(const char *fname, const char *path, char *fbuf, size_t size,
/* now append the file name */
i = strlen(fname);
- if ((fspace -= i) < 0) {
+ if (fspace < i) {
toolong:
fprintf(stderr, "openpath: pathname too long (ignored)\n");
*bp = '\0';
@@ -1646,6 +1648,7 @@ dln_find_1(const char *fname, const char *path, char *fbuf, size_t size,
fprintf(stderr, "\tFile \"%s\"\n", fname);
goto next;
}
+ fspace -= i;
memcpy(bp, fname, i + 1);
#if defined(DOSISH)