diff options
author | Kent R. Spillner <kspillner@cvs.openbsd.org> | 2015-07-17 18:55:01 +0000 |
---|---|---|
committer | Kent R. Spillner <kspillner@cvs.openbsd.org> | 2015-07-17 18:55:01 +0000 |
commit | 1b971fcb93e64e29d5d59cc682654c814365ff0f (patch) | |
tree | f9af57ac03c82fece6ad747ea9e3f33358094907 /sys/lib/libsa | |
parent | aa3bb553ddc223a95a129d905571374216026b7f (diff) |
Adjust type of link_len to match type of di_size in underlying struct, and
change type of len to size_t to match strlen(3) result. Drop unneeded
casts.
u_int64_t is overkill because the actual size is still limited to SYMLINK_MAX
but it is probably better to match the filesystem types.
ok miod@, guenther@
Diffstat (limited to 'sys/lib/libsa')
-rw-r--r-- | sys/lib/libsa/ufs.c | 11 | ||||
-rw-r--r-- | sys/lib/libsa/ufs2.c | 9 |
2 files changed, 9 insertions, 11 deletions
diff --git a/sys/lib/libsa/ufs.c b/sys/lib/libsa/ufs.c index 7516651e218..2b97c510d7e 100644 --- a/sys/lib/libsa/ufs.c +++ b/sys/lib/libsa/ufs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs.c,v 1.24 2014/07/22 18:03:03 deraadt Exp $ */ +/* $OpenBSD: ufs.c,v 1.25 2015/07/17 18:55:00 kspillner Exp $ */ /* $NetBSD: ufs.c,v 1.16 1996/09/30 16:01:22 ws Exp $ */ /*- @@ -465,8 +465,8 @@ ufs_open(char *path, struct open_file *f) * Check for symbolic link. */ if ((fp->f_di.di_mode & IFMT) == IFLNK) { - int link_len = fp->f_di.di_size; - int len; + u_int64_t link_len = fp->f_di.di_size; + size_t len; len = strlen(cp); @@ -479,8 +479,7 @@ ufs_open(char *path, struct open_file *f) bcopy(cp, &namebuf[link_len], len + 1); if (link_len < fs->fs_maxsymlinklen) { - bcopy(fp->f_di.di_shortlink, namebuf, - (unsigned) link_len); + bcopy(fp->f_di.di_shortlink, namebuf, link_len); } else { /* * Read file for symbolic link @@ -502,7 +501,7 @@ ufs_open(char *path, struct open_file *f) if (rc) goto out; - bcopy(buf, namebuf, (unsigned)link_len); + bcopy(buf, namebuf, link_len); } /* diff --git a/sys/lib/libsa/ufs2.c b/sys/lib/libsa/ufs2.c index 336f9ee0171..8abdb24e681 100644 --- a/sys/lib/libsa/ufs2.c +++ b/sys/lib/libsa/ufs2.c @@ -461,8 +461,8 @@ ufs2_open(char *path, struct open_file *f) * Check for symbolic link. */ if ((fp->f_di.di_mode & IFMT) == IFLNK) { - int link_len = fp->f_di.di_size; - int len; + u_int64_t link_len = fp->f_di.di_size; + size_t len; len = strlen(cp); @@ -475,8 +475,7 @@ ufs2_open(char *path, struct open_file *f) bcopy(cp, &namebuf[link_len], len + 1); if (link_len < fs->fs_maxsymlinklen) { - bcopy(fp->f_di.di_shortlink, namebuf, - (unsigned) link_len); + bcopy(fp->f_di.di_shortlink, namebuf, link_len); } else { /* * Read file for symbolic link @@ -498,7 +497,7 @@ ufs2_open(char *path, struct open_file *f) if (rc) goto out; - bcopy(buf, namebuf, (unsigned)link_len); + bcopy(buf, namebuf, link_len); } /* |