sulogin

Tito farmatito at tiscali.it
Fri Oct 20 20:20:04 UTC 2006


Hi Denis,
I've a little size optimization for sulogin that I'm sure will win your obfuscated code price ;-)

function                                             old     new   delta
sulogin_main                                   489     488      -1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-1)               Total: -1 bytes

This is only compile tested.

Ciao,
Tito

--- loginutils/sulogin_orig.c   2006-10-20 13:47:02.000000000 +0200
+++ loginutils/sulogin.c        2006-10-20 22:08:01.000000000 +0200
@@ -42,7 +42,6 @@
        const char * const *p;
        struct passwd *pwd;
        struct spwd *spwd;
-       const char *shell;

        logmode = LOGMODE_BOTH;
        openlog(applet_name, 0, LOG_AUTH);
@@ -106,14 +105,7 @@

        USE_SELINUX(renew_current_security_context());

-       shell = getenv("SUSHELL");
-       if (!shell) shell = getenv("sushell");
-       if (!shell) {
-               shell = "/bin/sh";
-               if (pwd->pw_shell[0])
-                       shell = pwd->pw_shell;
-       }
-       run_shell(shell, 1, 0, 0);
+       run_shell(getenv("SUSHELL") ? : getenv("sushell") ? : pwd->pw_shell ? : DEFAULT_SHELL, 1, 0, 0);
        /* never returns */

 auth_error:



More information about the busybox mailing list