Package: lkl
Version: 0.1.1-1
Severity: minor
Tags: patch

Hi,
Here's a patch to reorder the test on getuid/getgid
to allow option -h (showing help) without being root.
I don't want to run a program as root before knowing at least how to use it ;-)

Phil

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.22-3-vserver-686 (SMP w/1 CPU core)
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15)
Shell: /bin/sh linked to /bin/bash

Versions of packages lkl depends on:
ii  libc6                         2.7-5      GNU C Library: Shared libraries

lkl recommends no packages.

-- no debconf information
--- main.c.orig 2008-02-08 20:17:19.000000000 +0100
+++ main.c      2008-02-08 20:49:02.000000000 +0100
@@ -29,10 +29,6 @@
        memset(&lkl, 0, sizeof(lkl));
        lkl.port = KEYBOARD_PORT;
   
-       if(getuid() || getgid()){
-               printf("Have to be root to perform a iopl()!\n");
-               exit(1);
-       }
        if(argc == 1){
                usage();
                exit(1);
@@ -62,7 +58,6 @@
                                break;
                        case 's':
                                lkl.syslog = 1;
-                               openlog("lkl", LOG_PID, LOG_USER);
                                break;
                        case 'h':                       //print help page
                                usage();
@@ -72,6 +67,15 @@
                                exit(1);
        }
 
+       if(getuid() || getgid()){
+               printf("Have to be root to perform a iopl()!\n");
+               exit(1);
+       }
+
+       if(lkl.syslog == 1){
+               openlog("lkl", LOG_PID, LOG_USER);
+       }
+       
        if(lkl.log){
                printf("\nStarted to log port 0x%02x. Keymap is %s. The logfile 
is %s.\n", lkl.port, lkl.km_file, lkl.outfile);
                def_keymap(lkl.km_file);

Reply via email to