diff options
author | pjd <pjd@FreeBSD.org> | 2009-02-23 07:33:29 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2009-02-23 07:33:29 +0000 |
commit | 06d3dd6736d36f5075d5b09deedbaef57343db37 (patch) | |
tree | 4e4a63e872b7b79c7f0ca3a6d44adc2165d535f0 /tools/regression | |
parent | e58241dc4a0f1399719ef20837f4c764ea24bc37 (diff) | |
download | FreeBSD-src-06d3dd6736d36f5075d5b09deedbaef57343db37.zip FreeBSD-src-06d3dd6736d36f5075d5b09deedbaef57343db37.tar.gz |
Add explicit casting in few places.
It is only really necessary for open(2)'s third argument, which is optional and
obtained through stdarg(3). open(2)'s third argument is 32bit and we pass 64
bits. On little endian it works, because we take lower 32 bits, but on big
endian platforms we take upper 32 bits, so we end up with 0.
Reported by: Milan Čermák <Milan.Cermak@Sun.COM>
Diffstat (limited to 'tools/regression')
-rw-r--r-- | tools/regression/fstest/fstest.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/tools/regression/fstest/fstest.c b/tools/regression/fstest/fstest.c index 05950c9..94a7a19 100644 --- a/tools/regression/fstest/fstest.c +++ b/tools/regression/fstest/fstest.c @@ -337,7 +337,7 @@ show_stat(struct stat64 *sp, const char *what) printf("%lld", (long long)sp->st_ctime); #ifdef HAS_CHFLAGS else if (strcmp(what, "flags") == 0) - printf("%s", flags2str(chflags_flags, sp->st_flags)); + printf("%s", flags2str(chflags_flags, (long long)sp->st_flags)); #endif else if (strcmp(what, "type") == 0) { switch (sp->st_mode & S_IFMT) { @@ -443,17 +443,17 @@ call_syscall(struct syscall_desc *scall, char *argv[]) fprintf(stderr, "too few arguments\n"); exit(1); } - rval = open(STR(0), flags, (mode_t)NUM(2)); + rval = open(STR(0), (int)flags, (mode_t)NUM(2)); } else { if (i == 3) { fprintf(stderr, "too many arguments\n"); exit(1); } - rval = open(STR(0), flags); + rval = open(STR(0), (int)flags); } break; case ACTION_CREATE: - rval = open(STR(0), O_CREAT | O_EXCL, NUM(1)); + rval = open(STR(0), O_CREAT | O_EXCL, (mode_t)NUM(1)); if (rval >= 0) close(rval); break; @@ -461,7 +461,7 @@ call_syscall(struct syscall_desc *scall, char *argv[]) rval = unlink(STR(0)); break; case ACTION_MKDIR: - rval = mkdir(STR(0), NUM(1)); + rval = mkdir(STR(0), (mode_t)NUM(1)); break; case ACTION_RMDIR: rval = rmdir(STR(0)); @@ -476,30 +476,30 @@ call_syscall(struct syscall_desc *scall, char *argv[]) rval = rename(STR(0), STR(1)); break; case ACTION_MKFIFO: - rval = mkfifo(STR(0), NUM(1)); + rval = mkfifo(STR(0), (mode_t)NUM(1)); break; case ACTION_CHMOD: - rval = chmod(STR(0), NUM(1)); + rval = chmod(STR(0), (mode_t)NUM(1)); break; #ifdef HAS_LCHMOD case ACTION_LCHMOD: - rval = lchmod(STR(0), NUM(1)); + rval = lchmod(STR(0), (mode_t)NUM(1)); break; #endif case ACTION_CHOWN: - rval = chown(STR(0), NUM(1), NUM(2)); + rval = chown(STR(0), (uid_t)NUM(1), (gid_t)NUM(2)); break; case ACTION_LCHOWN: - rval = lchown(STR(0), NUM(1), NUM(2)); + rval = lchown(STR(0), (uid_t)NUM(1), (gid_t)NUM(2)); break; #ifdef HAS_CHFLAGS case ACTION_CHFLAGS: - rval = chflags(STR(0), str2flags(chflags_flags, STR(1))); + rval = chflags(STR(0), (unsigned long)str2flags(chflags_flags, STR(1))); break; #endif #ifdef HAS_LCHFLAGS case ACTION_LCHFLAGS: - rval = lchflags(STR(0), str2flags(chflags_flags, STR(1))); + rval = lchflags(STR(0), (unsigned long)str2flags(chflags_flags, STR(1))); break; #endif case ACTION_TRUNCATE: |