Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linux/linux_util.c
Show First 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | linux_emul_convpath(const char *path, enum uio_seg pathseg, | ||||
int retval; | int retval; | ||||
retval = kern_alternate_path(linux_emul_path, path, pathseg, pbuf, | retval = kern_alternate_path(linux_emul_path, path, pathseg, pbuf, | ||||
cflag, dfd); | cflag, dfd); | ||||
return (retval); | return (retval); | ||||
} | } | ||||
int | |||||
linux_alternate_link(struct nameidata *ndp, char *cp, int *linklen) | |||||
{ | |||||
size_t len; | |||||
char *ncp; | |||||
if (!LUSECONVPATH(td)) | |||||
return (0); | |||||
if (*linklen > 0 && cp[0] == '/') { | |||||
len = strlen(linux_emul_path); | |||||
if ((*linklen + len + 2) > MAXPATHLEN) | |||||
return (ENAMETOOLONG); | |||||
cp[*linklen] = '\0'; | |||||
len = *linklen + len; | |||||
ncp = malloc(len, M_TEMP, M_WAITOK); | |||||
sprintf(ncp, "%s%s", linux_emul_path, cp); | |||||
bcopy(ncp, cp, len); | |||||
free(ncp, M_TEMP); | |||||
kib: Why do you need ncp? Why not move cp content further up and then directly put linux_emul_path… | |||||
*linklen = len; | |||||
} | |||||
return (0); | |||||
} | |||||
void | void | ||||
linux_msg(const struct thread *td, const char *fmt, ...) | linux_msg(const struct thread *td, const char *fmt, ...) | ||||
{ | { | ||||
va_list ap; | va_list ap; | ||||
struct proc *p; | struct proc *p; | ||||
if (linux_debug == 0) | if (linux_debug == 0) | ||||
return; | return; | ||||
▲ Show 20 Lines • Show All 206 Lines • Show Last 20 Lines |
Why do you need ncp? Why not move cp content further up and then directly put linux_emul_path into the right place?