When calling variadic functions, NULL must be explicitly cast to a
desired type.
This is noted in the exec(3) manpage.
The call in newgrp.c was changed for consistency.
Signed-off-by: Egor Chelak <egor.chelak@gmail.com>
Since aarch64 kernel can be configured with compat 32-bit support
enabled, extend translation rules in a way similar to x86/x86_64.
Suggested-by: "Dmitry V. Levin" <ldv@altlinux.org>
Signed-off-by: Alexey Gladkov <gladkov.alexey@gmail.com>
When other compatible architectures are introduced, they will also have
to be added to the verifier.
Signed-off-by: Alexey Gladkov <gladkov.alexey@gmail.com>
This change fixes "warning: variable 'var' may be uninitialized when used
here [-Wconditional-uninitialized]" warnings reported in various files.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
On architectures without special personalities setarch uses the contents
of a local variable with automatic storage duration after return from
the function, causing it to report a spurious error.
$ setarch m68k
setarch: Kernel cannot set architecture to m68k
Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
The big-endian version maps generic "ppc" and "ppc32" aliases to
PER_LINUX32. It seems that we can do the same for little-endian.
Note that SYS_personality does not care about LE/BE, it's 32 or 64 bit.
Signed-off-by: Karel Zak <kzak@redhat.com>
Remove global variable, skip unnecessary comparison, and remove version
printing function when a simple printf() can do the job. In same go fix
compiler warning.
sys-utils/setarch.c:296:4: warning: null argument where non-null required
(argument 2) [-Wnonnull]
execl("/bin/bash", NULL);
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
changed in include/c.h and applied via sed:
sed -i 's/fprintf.*\(USAGE_MAN_TAIL.*\)/printf(\1/' $(git ls-files -- "*.c")
sed -i 's/print_usage_help_options\(.*\);/printf(USAGE_HELP_OPTIONS\1);/' $(git ls-files -- "*.c")
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Consolidate --help and --version descriptions. We are
now able to align them to the other options.
We changed include/c.h. The rest of this patch was
generated by sed, plus manually setting the right
alignment numbers. We do not change anything but
white spaces in the --help output.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Fix various typos in error messages, warnings, debug strings,
comments and names of static functions.
Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
Depending on architecture and kernel version, personality
syscall is either capable or incapable of returning an error.
If the return value is not an error, then it's the previous
personality value, which can be an arbitrary value
undistinguishable from an error value.
To make things clear, a second call is needed.
For more details about personality syscall peculiarities see
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=glibc-2.22-637-ge0043e17dfc5
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* call --help, --verbose and --list from one place only
* add 'archwrapper' variable to detect when called by symplink
* make --list available only got setchar(8) (but no for symlinks)
Reported-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
When the provided string does not match any architecture that
setarch knows about, the response stays "Unrecognized architecture",
but when trying to set the specified architecture does not have any
effect, then respond with "Kernel cannot set architecture to...".
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Use two separate strings for the two different forms of setarch,
instead of filling in an untranslated word into a single string.
Also use the standard angular brackets for nonliteral arguments.
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
This adds a concise description of a tool to its usage text.
A first form of this patch was proposed by Steven Honeyman
(see http://www.spinics.net/lists/util-linux-ng/msg09994.html).
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
There are some uname26 binaries flying around. Let's make it available
everywhere.
Internal SUSE references: fate313476, sr226509
CC: Stanislav Brabec <sbrabec@suse.cz>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
It seems to be pointless to spend time in ./configure phase when
preprocessor has to perform #ifndef check anyway.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Exit with instruction to run --help if unknown option is encountered.
Before the following example printed error, but resulted to an attempt
to run argument.
$ x86_64 -x ls
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Negative array index does technically work, but looks awkward and
can confuse static analyser such as cppcheck.
[sys-utils/setarch.c:267]: (error) Array index -1 is out of bounds
Signed-off-by: Sami Kerola <kerolasa@iki.fi>