Skip to contentSkip to conversation

Segfault fixed

PATCH New Kronos 2 participants 2 messages May 19, 2005

lore
Share & tools
lore

Kronos

author
#0 lore raw

PATCH 1/1 Segfault fixed

Running "sensors -c" without any argument gives a segfault. This is caused by a wrong optstring passed to getopt_long. The fix is trivial:

main.c renamed from main.c~ +1 -1
@@ -158,7 +158,7 @@
   do_sets = 0;
   hide_adapter = 0;
   while (1) {
-    c = getopt_long(argc,argv,"hsvfAcu:",long_opts,NULL);
+    c = getopt_long(argc,argv,"hsvfAc:u:",long_opts,NULL);
     if (c = EOF)
       break;
     switch(c) {

ciao,
Kronos

Signature · 5 lines
Home: http://kronoz.cjb.net
Windows /win'dohz/ n. : thirty-two  bit extension and graphical shell to
a sixteen  bit patch to an  eight bit operating system  originally coded
for a  four bit microprocessor  which was  written by a  two-bit company
that can't stand a bit of competition.
#1 lore raw

PATCH 1/1 Segfault fixed

Quoted 9 lines

Running "sensors -c" without any argument gives a segfault. This is caused by a wrong optstring passed to getopt_long. The fix is trivial:

main.c line 164

Quoted 8 lines
main.c renamed from main.c~ +1 -1
@@ -158,7 +158,7 @@
   do_sets = 0;
   hide_adapter = 0;
   while (1) {
-    c = getopt_long(argc,argv,"hsvfAcu:",long_opts,NULL);
+    c = getopt_long(argc,argv,"hsvfAc:u:",long_opts,NULL);
     if (c = EOF)
       break;
     switch(c) {

Exact, the fault is mine. I introduced this bug when adding the -A flag. The correct string is even "hsvfAc:u" (I moved the column from c to u). Shame on me.

Signature · 2 lines
Jean "Khali" Delvare
http://www.ensicaen.ismra.fr/~delvare/