Misc compiler warning fixes in lib/libc
Reviewed by: kevans, imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D26534
This commit is contained in:
parent
64ffe6d440
commit
d14f60e9ba
@ -67,7 +67,8 @@ __init_elf_aux_vector(void)
|
||||
}
|
||||
|
||||
static pthread_once_t aux_once = PTHREAD_ONCE_INIT;
|
||||
static int pagesize, osreldate, canary_len, ncpus, pagesizes_len, bsdflags;
|
||||
static int pagesize, osreldate, ncpus, bsdflags;
|
||||
static size_t canary_len, pagesizes_len;
|
||||
static int hwcap_present, hwcap2_present;
|
||||
static char *canary, *pagesizes, *execpath;
|
||||
static void *ps_strings, *timekeep;
|
||||
@ -245,16 +246,21 @@ int
|
||||
_elf_aux_info(int aux, void *buf, int buflen)
|
||||
{
|
||||
int res;
|
||||
size_t buflen_;
|
||||
|
||||
__init_elf_aux_vector();
|
||||
if (__elf_aux_vector == NULL)
|
||||
return (ENOSYS);
|
||||
_once(&aux_once, init_aux);
|
||||
|
||||
if (buflen < 0)
|
||||
return (EINVAL);
|
||||
buflen_ = (size_t)buflen;
|
||||
|
||||
switch (aux) {
|
||||
case AT_CANARY:
|
||||
if (canary != NULL && canary_len >= buflen) {
|
||||
memcpy(buf, canary, buflen);
|
||||
if (canary != NULL && canary_len >= buflen_) {
|
||||
memcpy(buf, canary, buflen_);
|
||||
memset(canary, 0, canary_len);
|
||||
canary = NULL;
|
||||
res = 0;
|
||||
@ -267,35 +273,35 @@ _elf_aux_info(int aux, void *buf, int buflen)
|
||||
else if (buf == NULL)
|
||||
res = EINVAL;
|
||||
else {
|
||||
if (strlcpy(buf, execpath, buflen) >= buflen)
|
||||
if (strlcpy(buf, execpath, buflen_) >= buflen_)
|
||||
res = EINVAL;
|
||||
else
|
||||
res = 0;
|
||||
}
|
||||
break;
|
||||
case AT_HWCAP:
|
||||
if (hwcap_present && buflen == sizeof(u_long)) {
|
||||
if (hwcap_present && buflen_ == sizeof(u_long)) {
|
||||
*(u_long *)buf = hwcap;
|
||||
res = 0;
|
||||
} else
|
||||
res = ENOENT;
|
||||
break;
|
||||
case AT_HWCAP2:
|
||||
if (hwcap2_present && buflen == sizeof(u_long)) {
|
||||
if (hwcap2_present && buflen_ == sizeof(u_long)) {
|
||||
*(u_long *)buf = hwcap2;
|
||||
res = 0;
|
||||
} else
|
||||
res = ENOENT;
|
||||
break;
|
||||
case AT_PAGESIZES:
|
||||
if (pagesizes != NULL && pagesizes_len >= buflen) {
|
||||
memcpy(buf, pagesizes, buflen);
|
||||
if (pagesizes != NULL && pagesizes_len >= buflen_) {
|
||||
memcpy(buf, pagesizes, buflen_);
|
||||
res = 0;
|
||||
} else
|
||||
res = ENOENT;
|
||||
break;
|
||||
case AT_PAGESZ:
|
||||
if (buflen == sizeof(int)) {
|
||||
if (buflen_ == sizeof(int)) {
|
||||
if (pagesize != 0) {
|
||||
*(int *)buf = pagesize;
|
||||
res = 0;
|
||||
@ -305,7 +311,7 @@ _elf_aux_info(int aux, void *buf, int buflen)
|
||||
res = EINVAL;
|
||||
break;
|
||||
case AT_OSRELDATE:
|
||||
if (buflen == sizeof(int)) {
|
||||
if (buflen_ == sizeof(int)) {
|
||||
if (osreldate != 0) {
|
||||
*(int *)buf = osreldate;
|
||||
res = 0;
|
||||
@ -315,7 +321,7 @@ _elf_aux_info(int aux, void *buf, int buflen)
|
||||
res = EINVAL;
|
||||
break;
|
||||
case AT_NCPUS:
|
||||
if (buflen == sizeof(int)) {
|
||||
if (buflen_ == sizeof(int)) {
|
||||
if (ncpus != 0) {
|
||||
*(int *)buf = ncpus;
|
||||
res = 0;
|
||||
@ -325,7 +331,7 @@ _elf_aux_info(int aux, void *buf, int buflen)
|
||||
res = EINVAL;
|
||||
break;
|
||||
case AT_TIMEKEEP:
|
||||
if (buflen == sizeof(void *)) {
|
||||
if (buflen_ == sizeof(void *)) {
|
||||
if (timekeep != NULL) {
|
||||
*(void **)buf = timekeep;
|
||||
res = 0;
|
||||
@ -335,14 +341,14 @@ _elf_aux_info(int aux, void *buf, int buflen)
|
||||
res = EINVAL;
|
||||
break;
|
||||
case AT_BSDFLAGS:
|
||||
if (buflen == sizeof(int)) {
|
||||
if (buflen_ == sizeof(int)) {
|
||||
*(int *)buf = bsdflags;
|
||||
res = 0;
|
||||
} else
|
||||
res = EINVAL;
|
||||
break;
|
||||
case AT_PS_STRINGS:
|
||||
if (buflen == sizeof(void *)) {
|
||||
if (buflen_ == sizeof(void *)) {
|
||||
if (ps_strings != NULL) {
|
||||
*(void **)buf = ps_strings;
|
||||
res = 0;
|
||||
|
@ -25,6 +25,9 @@ __FBSDID("$FreeBSD$");
|
||||
#include <string.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
char * __freebsd11_basename_r(const char *path, char *bname);
|
||||
char * __freebsd11_basename(char *path);
|
||||
|
||||
char *
|
||||
__freebsd11_basename_r(const char *path, char *bname)
|
||||
{
|
||||
|
@ -47,6 +47,11 @@ __FBSDID("$FreeBSD$");
|
||||
* encryption, make sure you've got libcrypt.a around.
|
||||
*/
|
||||
|
||||
int __freebsd11_des_setkey(const char *key);
|
||||
int __freebsd11_des_cipher(const char *in, char *out, long salt, int num_iter);
|
||||
int __freebsd11_setkey(const char *key);
|
||||
int __freebsd11_encrypt(char *block, int flag);
|
||||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
__freebsd11_des_setkey(const char *key __unused)
|
||||
|
@ -25,6 +25,8 @@ __FBSDID("$FreeBSD$");
|
||||
#include <string.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
char * __freebsd11_dirname(char *path);
|
||||
|
||||
char *
|
||||
__freebsd11_dirname(char *path)
|
||||
{
|
||||
|
@ -633,9 +633,8 @@ fts_build(FTS *sp, int type)
|
||||
FTSENT *cur, *tail;
|
||||
DIR *dirp;
|
||||
void *oldaddr;
|
||||
size_t dnamlen;
|
||||
int cderrno, descend, len, level, maxlen, nlinks, oflag, saved_errno,
|
||||
nostat, doadjust;
|
||||
nostat, doadjust, dnamlen;
|
||||
char *cp;
|
||||
|
||||
/* Set current node pointer. */
|
||||
@ -745,7 +744,7 @@ fts_build(FTS *sp, int type)
|
||||
if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name))
|
||||
continue;
|
||||
|
||||
if ((p = fts_alloc(sp, dp->d_name, (int)dnamlen)) == NULL)
|
||||
if ((p = fts_alloc(sp, dp->d_name, dnamlen)) == NULL)
|
||||
goto mem1;
|
||||
if (dnamlen >= maxlen) { /* include space for NUL */
|
||||
oldaddr = sp->fts_path;
|
||||
|
@ -33,6 +33,9 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include "fts-compat11.h"
|
||||
|
||||
int freebsd11_ftw(const char *path, int (*fn)(const char *,
|
||||
const struct freebsd11_stat *, int), int nfds);
|
||||
|
||||
int
|
||||
freebsd11_ftw(const char *path,
|
||||
int (*fn)(const char *, const struct freebsd11_stat *, int), int nfds)
|
||||
|
@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <signal.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "libc_private.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user