#endif /* KIOCSRATE */
}
-void
+static void
sigalrmhandler( int sig ) {
fprintf( stderr, "kbdrate: Failed waiting for kbd controller!\n" );
raise( SIGINT );
do {
lseek( fd, 0x64, 0 );
- read( fd, &data, 1 );
+ if (read( fd, &data, 1 ) == -1) {
+ perror( "read" );
+ exit( 1 );
+ }
} while ((data & 2) == 2 ); /* wait */
lseek( fd, 0x60, 0 );
data = 0xf3; /* set typematic rate */
- write( fd, &data, 1 );
+ if (write( fd, &data, 1 ) == -1) {
+ perror( "write" );
+ exit( 1 );
+ }
do {
lseek( fd, 0x64, 0 );
- read( fd, &data, 1 );
+ if (read( fd, &data, 1 ) == -1) {
+ perror( "read" );
+ exit( 1 );
+ }
} while ((data & 2) == 2 ); /* wait */
alarm( 0 );
lseek( fd, 0x60, 0 );
sleep( 1 );
- write( fd, &value, 1 );
+ if (write( fd, &value, 1 ) == -1) {
+ perror( "write" );
+ exit( 1 );
+ }
close( fd );
#include <signal.h>
#include <errno.h>
#include <linux/kd.h>
+#include <stdio.h>
#include <stdlib.h> /* system */
#include <fcntl.h> /* open */
#include <sys/ioctl.h> /* ioctl */
void
sighup(){
- system("openvt -s -l bash");
+ if (system("openvt -s -l bash") == -1) {
+ perror("system");
+ exit(1);
+ }
signal(SIGHUP, sighup);
}
-main(){
+int
+main(void) {
int fd;
fd = open("/dev/tty0", 0);
* aeb - 941025
*
*/
+#include <stdio.h>
+#include <stdlib.h>
#include <signal.h>
#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
#include <linux/kd.h>
void
-sighup(){
- system("openvt -s -l -- login -h spawn");
+sighup() {
+ if (system("openvt -s -l -- login -h spawn") == -1) {
+ perror("system");
+ exit(1);
+ }
signal(SIGHUP, sighup);
}
-main(){
+int
+main(void) {
int fd;
fd = open("/dev/tty0", 0);