diff --git a/linux32.c b/linux32.c index 7a14367..e5ede3d 100644 --- a/linux32.c +++ b/linux32.c @@ -1,7 +1,9 @@ /* Written 2002 by Andi Kleen */ -#include -#undef personality +#include +#include #include +#include +#include #include #include @@ -20,24 +22,41 @@ int main(int ac, char **av) { int pers = DFL_PER; - if (!av[1]) { - fprintf(stderr, "usage: %s [--3gb] [--4gb] program args ...\n", av[0]); -#if DFL_PER == PER_LINUX32_3GB - fprintf(stderr, "Default is --3gb to limit the address space of the 32bit children to 3GB\n"); -#endif - exit(1); - } - if (!strcmp(av[0],"linux64")) pers= PER_LINUX; - else if (!strcmp(av[0],"linux32")) pers = DFL_PER; + char *progname; + + progname = basename(av[0]); - if (!strcmp(av[1], "--3gb")) { - pers = PER_LINUX32_3GB; - av++; - } - if (!strcmp(av[1], "--4gb")) { - pers = PER_LINUX32; - av++; - } + if (!strcmp(progname, "linux64")) { + pers= PER_LINUX; + + /* ignore --3gb or --4gb for linux64 */ + if (av[1] && (!strcmp(av[1], "--3gb") || !strcmp(av[1], "--4gb"))) + av++; + } + else if (!strcmp(progname,"linux32")) { + pers = DFL_PER; + + if (av[1] && !strcmp(av[1], "--3gb")) { + pers = PER_LINUX32_3GB; + av++; + } + if (av[1] && !strcmp(av[1], "--4gb")) { + pers = PER_LINUX32; + av++; + } + } + + if (!av[1]) { + if (pers == PER_LINUX) { /* 64 bit, no options */ + fprintf(stderr, "usage: %s program args ...\n", progname); + } else { + fprintf(stderr, "usage: %s [--3gb] [--4gb] program args ...\n", progname); +#if DFL_PER == PER_LINUX32_3GB + fprintf(stderr, "Default is --3gb to limit the address space of the 32bit children to 3GB\n"); +#endif + } + exit(1); + } if (personality(pers) < 0) { fprintf(stderr, "Cannot set %x personality: %s\n", pers, diff --git a/linux32.changes b/linux32.changes index d3f4416..aa11be0 100644 --- a/linux32.changes +++ b/linux32.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Wed Oct 10 13:28:18 CEST 2007 - bwalle@suse.de + +- fix some problems (#188554) + o make linux64 working even if it's called with the full path + o don't switch magically to linux32 if linux64 is called with + arguments (--3gb/--4gb) + o fix segmentation fault + ------------------------------------------------------------------- Wed Mar 1 11:19:34 CET 2006 - sf@suse.de diff --git a/linux32.spec b/linux32.spec index f8adc89..9e9bdb3 100644 --- a/linux32.spec +++ b/linux32.spec @@ -1,7 +1,7 @@ # # spec file for package linux32 (Version 1.0) # -# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine # package are under the same license as the package itself. # @@ -11,12 +11,12 @@ Name: linux32 BuildRequires: update-desktop-files -URL: ftp://ftp.x86-64.org/pub/linux/tools/linux32/ -License: GPL +Url: ftp://ftp.x86-64.org/pub/linux/tools/linux32/ +License: GPL v2 or later Group: System/Kernel Summary: 32-Bit Emulation Utility for x86-64 Version: 1.0 -Release: 347 +Release: 414 BuildRoot: %{_tmppath}/%{name}-%{version}-build #Recommends: kdebase3 Source0: linux32.c @@ -65,8 +65,13 @@ ln linux32 linux64 /usr/share/man/man1/linux64.1.gz /usr/share/applications/* /usr/share/pixmaps/* - -%changelog -n linux32 +%changelog +* Wed Oct 10 2007 - bwalle@suse.de +- fix some problems (#188554) + o make linux64 working even if it's called with the full path + o don't switch magically to linux32 if linux64 is called with + arguments (--3gb/--4gb) + o fix segmentation fault * Wed Mar 01 2006 - sf@suse.de - added -32bit to name and generics name in .desktop file (#52279) * Wed Jan 25 2006 - mls@suse.de