diff options
author | Theodore Ts'o <tytso@mit.edu> | 2007-07-04 16:28:47 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2007-07-04 19:55:03 -0400 |
commit | 29a5deed215573ff287d27460de620aa7fff812a (patch) | |
tree | fef6dfc60bfc27fec1c85315faf013e8766561c4 /config | |
parent | a3f464ffe7646599647ef16d3fdee7179943eb94 (diff) | |
download | e2fsprogs-29a5deed215573ff287d27460de620aa7fff812a.tar.gz |
Improve the config/parse_types.sh helper script
Fix a potential security problem if e2fsprogs is built as root (as
Gentoo does!). In addition fix the script and how it is called from
the configure script so that it does the right thing when
cross-compiling.
Fixes-Gentoo-bug: #146903
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'config')
-rwxr-xr-x | config/parse-types.sh | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/config/parse-types.sh b/config/parse-types.sh index f4014ea3..8da34fd3 100755 --- a/config/parse-types.sh +++ b/config/parse-types.sh @@ -1,15 +1,6 @@ #!/bin/sh -ASM_TYPES=/usr/include/asm/types.h - -if test ! -f $ASM_TYPES -then - echo "" > asm_types.h - echo "No asm_types file found" - exit 1 -fi - -cat > /tmp/sed.script << "EOF" +cat > sed.script << "EOF" /^#/d /^$/d s/__extension__ // @@ -17,11 +8,16 @@ s/typedef \(.*\) __u\([1-9]*\);/#define __U\2_TYPEDEF \1/ s/typedef \(.*\) __s\([1-9]*\);/#define __S\2_TYPEDEF \1/ EOF -gcc -E $ASM_TYPES | sed -f /tmp/sed.script | grep ^# > asm_types.h +echo '#include <asm/types.h>' | ${CPP-${CC-gcc} -E} - | \ + sed -f sed.script | grep ^# > asm_types.h + +rm sed.script cp asm_types.h asm_types.c cat >> asm_types.c <<EOF +#include <stdio.h> +#include <stdlib.h> main(int argc, char **argv) { #ifdef __U8_TYPEDEF @@ -102,7 +98,7 @@ main(int argc, char **argv) } EOF -cc -o asm_types asm_types.c +${BUILD_CC-${CC-gcc}} -o asm_types asm_types.c if ! ./asm_types then echo "Problem detected with asm_types.h" |