diff options
author | dchagin <dchagin@FreeBSD.org> | 2015-01-04 10:34:02 +0000 |
---|---|---|
committer | dchagin <dchagin@FreeBSD.org> | 2015-01-04 10:34:02 +0000 |
commit | e777b160fa32963798410d1f0c18edb6db095d38 (patch) | |
tree | ec1007884dda89ab3135d582681ec1114cd6039b /sys/compat | |
parent | e5abd97f65871ce2a6c15322c4201130ba69abb8 (diff) | |
download | FreeBSD-src-e777b160fa32963798410d1f0c18edb6db095d38.zip FreeBSD-src-e777b160fa32963798410d1f0c18edb6db095d38.tar.gz |
Indeed, instead of hiding the kern___getcwd() bug by bogus cast
in r276564, change path type to char * (pathnames are always char *).
And remove bogus casts of malloc().
kern___getcwd() internally doesn't actually use or support u_char *
paths, except to copy them to a normal char * path.
These changes are not visible to libc as libc/gen/getcwd.c misdeclares
__getcwd() as taking a plain char * path.
While here remove _SYS_SYSPROTO_H_ for __getcwd() syscall as
we always have sysproto.h.
Pointed out by: bde
MFC after: 1 week
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/freebsd32/syscalls.master | 2 | ||||
-rw-r--r-- | sys/compat/linux/linux_getcwd.c | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/sys/compat/freebsd32/syscalls.master b/sys/compat/freebsd32/syscalls.master index 5d445a5..ce655bc 100644 --- a/sys/compat/freebsd32/syscalls.master +++ b/sys/compat/freebsd32/syscalls.master @@ -583,7 +583,7 @@ 323 AUE_NULL OBSOL thr_wakeup 324 AUE_MLOCKALL NOPROTO { int mlockall(int how); } 325 AUE_MUNLOCKALL NOPROTO { int munlockall(void); } -326 AUE_GETCWD NOPROTO { int __getcwd(u_char *buf, u_int buflen); } +326 AUE_GETCWD NOPROTO { int __getcwd(char *buf, u_int buflen); } 327 AUE_NULL NOPROTO { int sched_setparam (pid_t pid, \ const struct sched_param *param); } diff --git a/sys/compat/linux/linux_getcwd.c b/sys/compat/linux/linux_getcwd.c index 3f2b475..1c7080d 100644 --- a/sys/compat/linux/linux_getcwd.c +++ b/sys/compat/linux/linux_getcwd.c @@ -186,7 +186,7 @@ linux_getcwd_scandir(lvpp, uvpp, bpp, bufp, td) dirbuflen = DIRBLKSIZ; if (dirbuflen < va.va_blocksize) dirbuflen = va.va_blocksize; - dirbuf = (char *)malloc(dirbuflen, M_TEMP, M_WAITOK); + dirbuf = malloc(dirbuflen, M_TEMP, M_WAITOK); #if 0 unionread: @@ -413,7 +413,7 @@ out: int linux_getcwd(struct thread *td, struct linux_getcwd_args *args) { - caddr_t bp, bend, path; + char *bp, *bend, *path; int error, len, lenused; #ifdef DEBUG @@ -428,9 +428,9 @@ linux_getcwd(struct thread *td, struct linux_getcwd_args *args) else if (len < 2) return ERANGE; - path = (char *)malloc(len, M_TEMP, M_WAITOK); + path = malloc(len, M_TEMP, M_WAITOK); - error = kern___getcwd(td, (u_char *)path, UIO_SYSSPACE, len); + error = kern___getcwd(td, path, UIO_SYSSPACE, len); if (!error) { lenused = strlen(path) + 1; if (lenused <= args->bufsize) { |