diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-06 15:13:56 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-06 15:13:56 +0900 |
commit | ca343c4e2493c8d05e73ab62c89b9245841a32ea (patch) | |
tree | 5036211303caceaba888736e0a31d273145bcfda | |
parent | 629aefd5216f14688e3f0509d83928315a0ad236 (diff) | |
download | chrpath-ca343c4e2493c8d05e73ab62c89b9245841a32ea.tar.gz chrpath-ca343c4e2493c8d05e73ab62c89b9245841a32ea.tar.bz2 chrpath-ca343c4e2493c8d05e73ab62c89b9245841a32ea.zip |
Imported Upstream version 0.16upstream/0.16upstream
-rw-r--r-- | Makefile.am | 4 | ||||
-rw-r--r-- | NEWS | 5 | ||||
-rw-r--r-- | README | 4 | ||||
-rw-r--r-- | acinclude.m4 | 4 | ||||
-rwxr-xr-x | bootstrap | 5 | ||||
-rw-r--r-- | chrpath.c | 27 | ||||
-rwxr-xr-x | config.guess | 34 | ||||
-rwxr-xr-x | config.sub | 6 | ||||
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | elf.c | 6 | ||||
-rw-r--r-- | killrpath.c | 9 | ||||
-rw-r--r-- | main.c | 1 |
12 files changed, 80 insertions, 29 deletions
diff --git a/Makefile.am b/Makefile.am index 92229b7..b50ad21 100644 --- a/Makefile.am +++ b/Makefile.am @@ -20,6 +20,10 @@ chrpath_SOURCES = \ EXTRA_DIST = $(man_MANS) +config-updates: + GET 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' > config.guess + GET 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD' > config.sub + CLEANFILES = *.bb *.bbg *.da *.gcov testsuite/*.bb testsuite/*.bbg coverage: all check for f in *.c; do gcov $$f; done @@ -1,3 +1,8 @@ +New in 0.16 released 2014-01-14: + * Fixed all minor bugs discovered by Coverity. + * Updated config.sub and config.guess from the GNU project. + * Mention new project mailing list in the documentation. + New in 0.15 released 2013-11-24: * Updated config.sub and config.guess from the GNU project to work with newer architectures. Thanks to isha vishnoi for the heads up. @@ -27,7 +27,7 @@ Source, patches and fixes: The latest source is available from <URL: https://alioth.debian.org/frs/?group_id=31052 > -The project repository is available from -<URL: https://alioth.debian.org/projects/chrpath/ > +The project repository and developer mailing list are available +from <URL: https://alioth.debian.org/projects/chrpath/ > Send patches and updates to the Alioth project. diff --git a/acinclude.m4 b/acinclude.m4 index 62b03c1..73a7097 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -8,7 +8,7 @@ dnl JAPHAR_GREP_CFLAGS(flag, cmd_if_missing, cmd_if_present) dnl dnl From Japhar. Report changes to japhar@hungry.com dnl -AC_DEFUN(JAPHAR_GREP_CFLAGS, +AC_DEFUN([JAPHAR_GREP_CFLAGS], [case "$CFLAGS" in "$1" | "$1 "* | *" $1" | *" $1 "* ) ifelse($#, 3, [$3], [:]) @@ -19,7 +19,7 @@ AC_DEFUN(JAPHAR_GREP_CFLAGS, esac ]) -AC_DEFUN(CHRPATH_LDRPATH_OPTION, +AC_DEFUN([CHRPATH_LDRPATH_OPTION], [AC_REQUIRE([AC_CANONICAL_TARGET])[]dnl case "$target" in *-linux*|*-gnu*|*-k*bsd*-gnu) diff --git a/bootstrap b/bootstrap new file mode 100755 index 0000000..210db5f --- /dev/null +++ b/bootstrap @@ -0,0 +1,5 @@ +#!/bin/sh +aclocal +autoheader +automake -ac +autoconf @@ -89,6 +89,7 @@ chrpath(const char *filename, const char *newpath, int convert) if (0 != elf_find_dynamic_section(fd, &ehdr, &phdr)) { perror("found no dynamic section"); + elf_close(fd); return 1; } @@ -96,14 +97,16 @@ chrpath(const char *filename, const char *newpath, int convert) if (dyns == NULL) { perror ("allocating memory for dynamic section"); + elf_close(fd); return 1; } memset(dyns, 0, PHDR(p_filesz)); if (lseek(fd, PHDR(p_offset), SEEK_SET) == -1 - || read(fd, dyns, PHDR(p_filesz)) != (int)PHDR(p_filesz)) + || read(fd, dyns, PHDR(p_filesz)) != (ssize_t)PHDR(p_filesz)) { perror ("reading dynamic section"); free(dyns); + elf_close(fd); return 1; } @@ -121,6 +124,7 @@ chrpath(const char *filename, const char *newpath, int convert) { printf("%s: no rpath or runpath tag found.\n", filename); free(dyns); + elf_close(fd); return 2; } @@ -128,6 +132,7 @@ chrpath(const char *filename, const char *newpath, int convert) { perror ("positioning for sections"); free(dyns); + elf_close(fd); return 1; } @@ -138,6 +143,7 @@ chrpath(const char *filename, const char *newpath, int convert) { perror ("reading section header"); free(dyns); + elf_close(fd); return 1; } if (SHDR_W(sh_type) == SHT_STRTAB) @@ -147,31 +153,36 @@ chrpath(const char *filename, const char *newpath, int convert) { fprintf (stderr, "No string table found.\n"); free(dyns); + elf_close(fd); return 2; } - strtab = (char *)malloc(SHDR_O(sh_size)); + /* +1 for forced trailing null */ + strtab = (char *)calloc(1, SHDR_O(sh_size)+1); if (strtab == NULL) { perror ("allocating memory for string table"); free(dyns); + elf_close(fd); return 1; } - memset(strtab, 0, SHDR_O(sh_size)); if (lseek(fd, SHDR_O(sh_offset), SEEK_SET) == -1) { perror ("positioning for string table"); free(strtab); free(dyns); + elf_close(fd); return 1; } - if (read(fd, strtab, SHDR_O(sh_size)) != (int)SHDR_O(sh_size)) + if (read(fd, strtab, SHDR_O(sh_size)) != (ssize_t)SHDR_O(sh_size)) { perror ("reading string table"); free(strtab); free(dyns); + elf_close(fd); return 1; } + strtab[SHDR_O(sh_size)] = 0; /* make sure printed string is null terminated */ if ((int)SHDR_O(sh_size) < rpathoff) { @@ -179,6 +190,7 @@ chrpath(const char *filename, const char *newpath, int convert) elf_tagname(DYNSS(rpath_dyns_index, d_tag))); free(strtab); free(dyns); + elf_close(fd); return 5; } rpath = strtab+rpathoff; @@ -196,6 +208,9 @@ chrpath(const char *filename, const char *newpath, int convert) || write(fd, dyns, PHDR(p_filesz)) != (int)PHDR(p_filesz)) { perror ("converting RPATH to RUNPATH"); + free(strtab); + free(dyns); + elf_close(fd); return 1; } printf("%s: RPATH converted to RUNPATH\n", filename); @@ -209,6 +224,7 @@ chrpath(const char *filename, const char *newpath, int convert) { free(dyns); free(strtab); + elf_close(fd); return 0; } @@ -232,6 +248,7 @@ chrpath(const char *filename, const char *newpath, int convert) newpath, rpathlen); free(dyns); free(strtab); + elf_close(fd); return 7; } @@ -243,6 +260,7 @@ chrpath(const char *filename, const char *newpath, int convert) perror ("positioning for RPATH"); free(dyns); free(strtab); + elf_close(fd); return 1; } if (write(fd, rpath, rpathlen) != (int)rpathlen) @@ -250,6 +268,7 @@ chrpath(const char *filename, const char *newpath, int convert) perror ("writing RPATH"); free(dyns); free(strtab); + elf_close(fd); return 1; } printf("%s: new %s: %s\n", filename, diff --git a/config.guess b/config.guess index b79252d..4438cd7 100755 --- a/config.guess +++ b/config.guess @@ -1,8 +1,8 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2013 Free Software Foundation, Inc. +# Copyright 1992-2014 Free Software Foundation, Inc. -timestamp='2013-06-10' +timestamp='2014-01-01' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -50,7 +50,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2013 Free Software Foundation, Inc. +Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -1260,16 +1260,26 @@ EOF if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - case $UNAME_PROCESSOR in - i386) UNAME_PROCESSOR=x86_64 ;; - powerpc) UNAME_PROCESSOR=powerpc64 ;; - esac + if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # Avoid executing cc on OS X 10.9, as it ships with a stub + # that puts up a graphical alert prompting to install + # developer tools. Any system running Mac OS X 10.7 or + # later (Darwin 11 and later) is required to have a 64-bit + # processor. This is not true of the ARM version of Darwin + # that Apple uses in portable devices. + UNAME_PROCESSOR=x86_64 fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; @@ -1,8 +1,8 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2013 Free Software Foundation, Inc. +# Copyright 1992-2014 Free Software Foundation, Inc. -timestamp='2013-10-01' +timestamp='2014-01-01' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -68,7 +68,7 @@ Report bugs and patches to <config-patches@gnu.org>." version="\ GNU config.sub ($timestamp) -Copyright 1992-2013 Free Software Foundation, Inc. +Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." diff --git a/configure.ac b/configure.ac index 6fcac09..875f0f5 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT(chrpath, 0.15, pere@hungry.com) +AC_INIT(chrpath, 0.16, chrpath-devel@lists.alioth.debian.org) AC_CANONICAL_TARGET -AM_INIT_AUTOMAKE("chrpath", "0.15") +AM_INIT_AUTOMAKE("chrpath", "0.16") AC_CONFIG_SRCDIR(chrpath.c) AM_CONFIG_HEADER(config.h) @@ -86,10 +86,10 @@ elf_open(const char *filename, int flags, Elf_Ehdr *ehdr) } sz_phdr = is_e32() ? sizeof(Elf32_Phdr) : sizeof(Elf64_Phdr); - if (EHDR_PHS(e_phentsize) != sz_phdr) + if ((size_t)EHDR_PHS(e_phentsize) != sz_phdr) { - fprintf(stderr, "section size was read as %d, not %d!\n", - (int)EHDR_PHS(e_phentsize), (int)sz_phdr); + fprintf(stderr, "section size was read as %zd, not %zd!\n", + (size_t)EHDR_PHS(e_phentsize), sz_phdr); close(fd); return -1; } diff --git a/killrpath.c b/killrpath.c index 4acb673..c19fc55 100644 --- a/killrpath.c +++ b/killrpath.c @@ -49,6 +49,7 @@ killrpath(const char *filename) if (0 != elf_find_dynamic_section(fd, &ehdr, &phdr)) { perror("found no dynamic section"); + elf_close(fd); return 1; } @@ -56,13 +57,16 @@ killrpath(const char *filename) if (dyns == NULL) { perror ("allocating memory for dynamic section"); + elf_close(fd); return 1; } memset(dyns, 0, PHDR(p_memsz)); if (lseek(fd, PHDR(p_offset), SEEK_SET) == -1 - || read(fd, dyns, PHDR(p_filesz)) != (int)PHDR(p_filesz)) + || read(fd, dyns, PHDR(p_filesz)) != (ssize_t)PHDR(p_filesz)) { perror ("reading dynamic section"); + free(dyns); + elf_close(fd); return 1; } @@ -91,9 +95,12 @@ killrpath(const char *filename) || write(fd, dyns, PHDR(p_filesz)) != (int)PHDR(p_filesz)) { perror ("writing dynamic section"); + free(dyns); + elf_close(fd); return 1; } + free(dyns); elf_close(fd); return 0; @@ -111,6 +111,7 @@ main(int argc, char * const argv[]) break; default: printf("Invalid argument '%c'\n", opt); + /* Fall through */ case 'h': usage(argv[0]); exit(0); |