[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [BusyBox] [PATCH] for openvt.c in bb_unstable
From:       Tito <farmatito () tiscali ! it>
Date:       2003-04-22 14:42:49
[Download RAW message or body]

Hi to all,
this patch for openvt.c removes some dead code (an xmalloc) and unused or
not necessary vars thus reducing size from 1576 to 1524 bytes.
I tested  it a bit  and for me it seems to work.
So apply if you like it.
Ciao
Tito

["openvt_patch.txt" (text/plain)]

--- console-tools/openvt_orig.c	2003-03-19 09:11:29.000000000 +0000
+++ console-tools/openvt.c	2003-04-22 14:24:42.000000000 +0000
@@ -3,6 +3,7 @@
  *  openvt.c - open a vt to run a command.
  *
  *  busyboxed by Quy Tonthat <quy@signal3.com>
+ *  hacked by Tito <farmatito@tiscali.it>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -39,8 +40,7 @@
 	int fd;
 	int vtno;
 	char vtname[sizeof VTNAME + 2];
-	char * cmd = NULL;
-	char * cmd_args = NULL;
+
 
 	if (argc < 3)
         bb_show_usage();
@@ -56,9 +56,8 @@
 
 	sprintf(vtname, VTNAME, vtno);
 
-	cmd = argv[2];
-	cmd_args = xmalloc(80);
-	cmd_args[0] = '\0';
+	argv+=2;
+	argc-=2;
 
 	if((pid = fork()) == 0) {
 		/* leave current vt */
@@ -83,8 +82,7 @@
 		dup(fd);
 		dup(fd);
 
-		execvp(cmd, &argv[2]);
-		/*execlp(cmd, cmd_args);*/
+		execvp(argv[0], argv);
 		_exit(1);
 	}
 	return EXIT_SUCCESS;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic