mirror of https://github.com/xemu-project/xemu.git
bsd-user: start to cleanup the mess
A number of small cleanups to get started. All the checkpatch.pl warnings for bsdload.c have been fixed, as well as a warning from qemu.h (though more remain and this patch series fails the format check still). I've also fixed a compile-time warning about a missing break. -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIzBAABCgAdFiEEIDX4lLAKo898zeG3bBzRKH2wEQAFAmCMJNgACgkQbBzRKH2w EQCRExAAoTm1MkLxUE/J9HSm2EOX+XVdaYveUlStCKXfDg7eI+S6rf7LVLQhLeKc 8r8MiSCQN2w4ggQcagZtx23hseEuy6Ilr+OYLZPNVVAwMmtwVjCloLp1kcq+Y3Kd nefapBB2WitKDR6cK8j8h6F+mZbAMSkToZiholaapL1Uo5qOQoOvClcSAe3yzJD6 JUdBmmLN4qD/w+h//xGYj/DBBglH1t9nUzdhbNtH52j3tPZuwJ8Wti6UB1EuyDXO WuxiiuHj7C4QqFOAtQ0uL+SoQ6P4sygxG8ppa88osvPBO2Mizj+s4RQdL2insOGM 1YaqliUgUk/Apg06dSHrZby9lpFyt4k01cJCIkH1Vz7GdkHYQYH+o+o1rvKMoVhK dwxhS7orFbc8tuBwGw534X2KX/lsV+C7QuEuq8JWpNf5XYznD9HDkHaA9hr6efXC JeWSY5+yhVVeBFKMgyKuUOYMAePhLcx8nSWj37Sc49L16kfuGKZow7qPwVv4KuiZ acFZxsFuqt13vP1cm+8s+W/UHmxw+z7LZzHEzwHr7t53ZM//WRE78jmLNpAIAW1P 1gVlMwoQcQG9RVpH6xaWW2PFo9zpb6G3PMxwTKB9wfAhkIKsthPfU5yDkC1nBSeM Rq8vJr5tu91VvYp9PMzb81mW1y4A3Yv4+xUIqRzL5RspIt/eOkI= =MbYr -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/bsdimp/tags/pull-bsd-user-20210430' into staging bsd-user: start to cleanup the mess A number of small cleanups to get started. All the checkpatch.pl warnings for bsdload.c have been fixed, as well as a warning from qemu.h (though more remain and this patch series fails the format check still). I've also fixed a compile-time warning about a missing break. # gpg: Signature made Fri 30 Apr 2021 16:40:08 BST # gpg: using RSA key 2035F894B00AA3CF7CCDE1B76C1CD1287DB01100 # gpg: Good signature from "Warner Losh <wlosh@netflix.com>" [unknown] # gpg: aka "Warner Losh <imp@bsdimp.com>" [unknown] # gpg: aka "Warner Losh <imp@freebsd.org>" [unknown] # gpg: aka "Warner Losh <imp@village.org>" [unknown] # gpg: aka "Warner Losh <wlosh@bsdimp.com>" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 2035 F894 B00A A3CF 7CCD E1B7 6C1C D128 7DB0 1100 * remotes/bsdimp/tags/pull-bsd-user-20210430: bsd-user: style tweak: Put {} around all if/else/for statements bsd-user: put back a break; that had gone missing... bsd-user: style tweak: return is not a function, eliminate () bsd-user: style tweak: keyword space ( bsd-user: whitespace changes Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
3e13d8e34b
|
@ -13,8 +13,9 @@ abi_long memcpy_to_target(abi_ulong dest, const void *src,
|
|||
void *host_ptr;
|
||||
|
||||
host_ptr = lock_user(VERIFY_WRITE, dest, len, 0);
|
||||
if (!host_ptr)
|
||||
if (!host_ptr) {
|
||||
return -TARGET_EFAULT;
|
||||
}
|
||||
memcpy(host_ptr, src, len);
|
||||
unlock_user(host_ptr, dest, 1);
|
||||
return 0;
|
||||
|
@ -28,7 +29,7 @@ static int count(char ** vec)
|
|||
vec++;
|
||||
}
|
||||
|
||||
return(i);
|
||||
return i;
|
||||
}
|
||||
|
||||
static int prepare_binprm(struct linux_binprm *bprm)
|
||||
|
@ -38,15 +39,15 @@ static int prepare_binprm(struct linux_binprm *bprm)
|
|||
int retval;
|
||||
|
||||
if (fstat(bprm->fd, &st) < 0) {
|
||||
return(-errno);
|
||||
return -errno;
|
||||
}
|
||||
|
||||
mode = st.st_mode;
|
||||
if (!S_ISREG(mode)) { /* Must be regular file */
|
||||
return(-EACCES);
|
||||
return -EACCES;
|
||||
}
|
||||
if (!(mode & 0111)) { /* Must have at least one execute bit set */
|
||||
return(-EACCES);
|
||||
return -EACCES;
|
||||
}
|
||||
|
||||
bprm->e_uid = geteuid();
|
||||
|
@ -75,10 +76,8 @@ static int prepare_binprm(struct linux_binprm *bprm)
|
|||
if (retval < 0) {
|
||||
perror("prepare_binprm");
|
||||
exit(-1);
|
||||
/* return(-errno); */
|
||||
}
|
||||
else {
|
||||
return(retval);
|
||||
} else {
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,11 +132,13 @@ int loader_exec(const char * filename, char ** argv, char ** envp,
|
|||
int i;
|
||||
|
||||
bprm.p = TARGET_PAGE_SIZE * MAX_ARG_PAGES - sizeof(unsigned int);
|
||||
for (i=0 ; i<MAX_ARG_PAGES ; i++) /* clear page-table */
|
||||
for (i = 0 ; i < MAX_ARG_PAGES ; i++) { /* clear page-table */
|
||||
bprm.page[i] = NULL;
|
||||
}
|
||||
retval = open(filename, O_RDONLY);
|
||||
if (retval < 0)
|
||||
if (retval < 0) {
|
||||
return retval;
|
||||
}
|
||||
bprm.fd = retval;
|
||||
bprm.filename = (char *)filename;
|
||||
bprm.argc = count(argv);
|
||||
|
@ -169,5 +170,5 @@ int loader_exec(const char * filename, char ** argv, char ** envp,
|
|||
for (i = 0 ; i < MAX_ARG_PAGES ; i++) {
|
||||
g_free(bprm.page[i]);
|
||||
}
|
||||
return(retval);
|
||||
return retval;
|
||||
}
|
||||
|
|
|
@ -199,6 +199,7 @@ static int sysctl_oldcvt(void *holdp, size_t holdlen, uint32_t kind)
|
|||
#else
|
||||
case CTLTYPE_LONG:
|
||||
*(uint64_t *)holdp = tswap64(*(long *)holdp);
|
||||
break;
|
||||
case CTLTYPE_ULONG:
|
||||
*(uint64_t *)holdp = tswap64(*(unsigned long *)holdp);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue