bin/155349: [patch] kbdmap segfault when rc.conf is non existent

Urankar Mikael mikael.urankar at
Mon Mar 7 14:40:07 UTC 2011

>Number:         155349
>Category:       bin
>Synopsis:       [patch] kbdmap segfault when rc.conf is non existent
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 07 14:40:07 UTC 2011
>Originator:     Urankar Mikael
FreeBSD 9.0-CURRENT FreeBSD 9.0-CURRENT #39 r219368M: Mon Mar  7 12:15:50 CET 2011     murankar at  amd64
kbdmap segfault when rc.conf is non existent

Here is the backtrace :

Starting program: /usr/obj/usr/src/usr.sbin/kbdmap/kbdmap
kbdcontrol: getting keymap: Inappropriate ioctl for device
You are not on a virtual console - expect certain strange side-effects
Could not open /etc/rc.conf for reading

Program received signal SIGSEGV, Segmentation fault.
0x00000008009214e7 in fclose () from /lib/
(gdb) bt full
#0  0x00000008009214e7 in fclose () from /lib/
No symbol table info available.
#1  0x000000000040249c in main (argc=1, argv=0x7fffffffd9a8) at /usr/src/usr.sbin/kbdmap/kbdmap.c:232
No locals.

Delete /etc/rc.conf and run kbdmap
Close the file stream only if it was successfully opened.

Patch attached with submission follows:

Index: kbdmap.c
--- kbdmap.c	(révision 219368)
+++ kbdmap.c	(copie de travail)
@@ -226,10 +226,10 @@
+		fclose(fp);
 	} else
 		fprintf(stderr, "Could not open %s for reading\n", sysconfig);
-	fclose(fp);
 	return fnt;


More information about the freebsd-bugs mailing list