su: do uid check earlier.

Change-Id: Ied4894019d2b0021e7f727569ff85650d209e5da
diff --git a/su/su.c b/su/su.c
index b87cece..f87f073 100644
--- a/su/su.c
+++ b/su/su.c
@@ -44,6 +44,13 @@
     struct passwd *pw;
     int uid, gid, myuid;
 
+    /* Until we have something better, only root and the shell can use su. */
+    myuid = getuid();
+    if (myuid != AID_ROOT && myuid != AID_SHELL) {
+        fprintf(stderr,"su: uid %d not allowed to su\n", myuid);
+        return 1;
+    }
+
     if(argc < 2) {
         uid = gid = 0;
     } else {
@@ -57,13 +64,6 @@
         }
     }
 
-    /* Until we have something better, only root and the shell can use su. */
-    myuid = getuid();
-    if (myuid != AID_ROOT && myuid != AID_SHELL) {
-        fprintf(stderr,"su: uid %d not allowed to su\n", myuid);
-        return 1;
-    }
-    
     if(setgid(gid) || setuid(uid)) {
         fprintf(stderr,"su: permission denied\n");
         return 1;