* [PATCH] setarch: print error when command runs without arguments
@ 2015-02-17 22:31 Sami Kerola
2015-02-19 9:56 ` Karel Zak
0 siblings, 1 reply; 2+ messages in thread
From: Sami Kerola @ 2015-02-17 22:31 UTC (permalink / raw)
To: util-linux; +Cc: Sami Kerola
$ ./setarch
Segmentation fault (core dumped)
$ coredumpctl gdb
...
Program terminated with signal SIGSEGV, Segmentation fault.
301 if (*argv[1] != '-') {
Reference: 5edb0ea6bbd57dd916417737f98c9109dc1ecb5b
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
sys-utils/setarch.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sys-utils/setarch.c b/sys-utils/setarch.c
index 76892ab..337f8fb 100644
--- a/sys-utils/setarch.c
+++ b/sys-utils/setarch.c
@@ -298,7 +298,7 @@ int main(int argc, char *argv[])
if (archwrapper)
arch = program_invocation_short_name; /* symlinks to setarch */
else {
- if (*argv[1] != '-') {
+ if (1 < argc && *argv[1] != '-') {
arch = argv[1];
argv[1] = argv[0]; /* for getopt_long() to get the program name */
argv++;
--
2.3.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] setarch: print error when command runs without arguments
2015-02-17 22:31 [PATCH] setarch: print error when command runs without arguments Sami Kerola
@ 2015-02-19 9:56 ` Karel Zak
0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2015-02-19 9:56 UTC (permalink / raw)
To: Sami Kerola; +Cc: util-linux
On Tue, Feb 17, 2015 at 10:31:48PM +0000, Sami Kerola wrote:
> sys-utils/setarch.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied, thanks.
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-02-19 9:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-17 22:31 [PATCH] setarch: print error when command runs without arguments Sami Kerola
2015-02-19 9:56 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox