/* Code indicating core file. */
#define CMAGIC 0421
-char *___strtok = NULL;
-
char *prog = NULL;
int debug = 0; /* debug mode */
int verbose = 0; /* verbose mode */
extern char *chroot_realpath(const char *chroot, const char *path,
char resolved_path[]);
+#if defined __UCLIBC_STATIC_LDCONFIG__ || !defined __UCLIBC_HAS_BSD_ERR__
/* These two are used internally -- you shouldn't need to use them */
static void verror_msg(const char *s, va_list p)
{
fprintf(stderr, "\n");
}
-static void attribute_noreturn err(int errnum, const char *s, ...)
+static attribute_noreturn void err(int errnum, const char *s, ...)
{
va_list p;
static void vperror_msg(const char *s, va_list p)
{
- int err = errno;
+ int e = errno;
if (s == 0)
s = "";
verror_msg(s, p);
if (*s)
s = ": ";
- fprintf(stderr, "%s%s\n", s, strerror(err));
+ fprintf(stderr, "%s%s\n", s, strerror(e));
}
static void warn(const char *s, ...)
vperror_msg(s, p);
va_end(p);
}
+#else
+# include <err.h>
+#endif
static void *xmalloc(size_t size)
{
#define readsonameXX readsoname64
#define __ELF_NATIVE_CLASS 64
#include "readsoname2.c"
-char *readsoname(char *name, FILE *infile, int expected_type,
- int *type, int elfclass)
+static char *readsoname(char *name, FILE *infile, int expected_type,
+ int *type, int elfclass)
{
char *res;
* If the expected, actual/deduced types missmatch we display a warning
* and use the actual/deduced type.
*/
-char *is_shlib(const char *dir, const char *name, int *type,
- int *islink, int expected_type)
+static char *is_shlib(const char *dir, const char *name, int *type,
+ int *islink, int expected_type)
{
char *good = NULL;
char *cp, *cp2;
&& N_MAGIC_SWAP(exec) != QMAGIC) {
elf_hdr = (ElfW(Ehdr) *) & exec;
if (elf_hdr->e_ident[0] != 0x7f ||
- strncmp((char *)elf_hdr->e_ident + 1, "ELF", 3) != 0)
+ strncmp((const char *)elf_hdr->e_ident + 1, "ELF", 3) != 0)
{
/* silently ignore linker scripts */
- if (strncmp((char *)&exec, "/* GNU ld", 9) != 0)
+ if (strncmp((const char *)&exec, "/* GNU ld", 9) != 0)
warnx("%s is not a shared library, skipping", buff);
} else {
/* always call readsoname to update type */
/* if the soname does not match the filename,
issue a warning, but only in debug mode. */
int len = strlen(good);
- if (debug && (strncmp(good, name, len) != 0
+ if (debug && (strncmp((const char *)good, name, len) != 0
|| (name[len] != '\0' && name[len] != '.')))
warnx("%s has inconsistent soname (%s)", buff, good);
}
}
/* update the symlink to new library */
-void link_shlib(const char *dir, const char *file, const char *so)
+static void link_shlib(const char *dir, const char *file, const char *so)
{
int change = 1;
char libname[BUFFER_SIZE];
}
/* figure out which library is greater */
-int libcmp(char *p1, char *p2)
+static int libcmp(char *p1, char *p2)
{
while (*p1) {
if (isdigit(*p1) && isdigit(*p2)) {
};
/* update all shared library links in a directory */
-void scan_dir(const char *rawname)
+static void scan_dir(const char *rawname)
{
DIR *dir;
const char *name;
}
#else
/* return the list of system-specific directories */
-char *get_extpath(void)
+static char *get_extpath(void)
{
char *res = NULL, *cp;
FILE *file;
- struct stat stat;
+ struct stat st;
char realconffile[BUFFER_SIZE];
if (!chroot_realpath(chroot_dir, conffile, realconffile))
return NULL;
if ((file = fopen(realconffile, "r")) != NULL) {
- fstat(fileno(file), &stat);
- res = xmalloc(stat.st_size + 1);
- fread(res, 1, stat.st_size, file);
+ fstat(fileno(file), &st);
+ res = xmalloc(st.st_size + 1);
+ (void)fread(res, 1, st.st_size, file);
fclose(file);
- res[stat.st_size] = '\0';
+ res[st.st_size] = '\0';
/* convert comments fo spaces */
for (cp = res; *cp; /*nada */ ) {
}
#endif
-static void attribute_noreturn usage(void)
+static attribute_noreturn void usage(void)
{
fprintf(stderr,
#ifdef __LDSO_CACHE_SUPPORT__