mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-31 22:33:53 -06:00
linux-user: Fix style problems in linuxload.c
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20210706234932.356913-3-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
parent
7aa9fe3a52
commit
a46955ff61
1 changed files with 20 additions and 22 deletions
|
@ -1,20 +1,19 @@
|
||||||
/* Code for loading Linux executables. Mostly linux kernel code. */
|
/* Code for loading Linux executables. Mostly linux kernel code. */
|
||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
|
|
||||||
#include "qemu.h"
|
#include "qemu.h"
|
||||||
|
|
||||||
#define NGROUPS 32
|
#define NGROUPS 32
|
||||||
|
|
||||||
/* ??? This should really be somewhere else. */
|
/* ??? This should really be somewhere else. */
|
||||||
abi_long memcpy_to_target(abi_ulong dest, const void *src,
|
abi_long memcpy_to_target(abi_ulong dest, const void *src, unsigned long len)
|
||||||
unsigned long len)
|
|
||||||
{
|
{
|
||||||
void *host_ptr;
|
void *host_ptr;
|
||||||
|
|
||||||
host_ptr = lock_user(VERIFY_WRITE, dest, len, 0);
|
host_ptr = lock_user(VERIFY_WRITE, dest, len, 0);
|
||||||
if (!host_ptr)
|
if (!host_ptr) {
|
||||||
return -TARGET_EFAULT;
|
return -TARGET_EFAULT;
|
||||||
|
}
|
||||||
memcpy(host_ptr, src, len);
|
memcpy(host_ptr, src, len);
|
||||||
unlock_user(host_ptr, dest, 1);
|
unlock_user(host_ptr, dest, 1);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -27,8 +26,7 @@ static int count(char ** vec)
|
||||||
for (i = 0; *vec; i++) {
|
for (i = 0; *vec; i++) {
|
||||||
vec++;
|
vec++;
|
||||||
}
|
}
|
||||||
|
return i;
|
||||||
return(i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int prepare_binprm(struct linux_binprm *bprm)
|
static int prepare_binprm(struct linux_binprm *bprm)
|
||||||
|
@ -38,15 +36,15 @@ static int prepare_binprm(struct linux_binprm *bprm)
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
if (fstat(bprm->fd, &st) < 0) {
|
if (fstat(bprm->fd, &st) < 0) {
|
||||||
return(-errno);
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
mode = st.st_mode;
|
mode = st.st_mode;
|
||||||
if (!S_ISREG(mode)) { /* Must be regular file */
|
if (!S_ISREG(mode)) { /* Must be regular file */
|
||||||
return(-EACCES);
|
return -EACCES;
|
||||||
}
|
}
|
||||||
if (!(mode & 0111)) { /* Must have at least one execute bit set */
|
if (!(mode & 0111)) { /* Must have at least one execute bit set */
|
||||||
return(-EACCES);
|
return -EACCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
bprm->e_uid = geteuid();
|
bprm->e_uid = geteuid();
|
||||||
|
@ -163,5 +161,5 @@ int loader_exec(int fdexec, const char *filename, char **argv, char **envp,
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(retval);
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue