8189b69
/*	--*- c -*--
8189b69
 * Copyright (C) 2009 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
8189b69
 *
8189b69
 * This program is free software; you can redistribute it and/or modify
8189b69
 * it under the terms of the GNU General Public License as published by
8189b69
 * the Free Software Foundation; version 3 of the License.
8189b69
 *
8189b69
 * This program is distributed in the hope that it will be useful,
8189b69
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8189b69
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
8189b69
 * GNU General Public License for more details.
8189b69
 *
8189b69
 * You should have received a copy of the GNU General Public License
8189b69
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
8189b69
 */
8189b69
8189b69
#include <stdlib.h>
8189b69
#include <unistd.h>
8189b69
8189b69
/* Hack around missing configurability of userhelper which closes all upper
8189b69
 * fds */
8189b69
int main(int argc, char *argv[])
8189b69
{
8189b69
	int	fd;
8189b69
8189b69
	if (argc >= 2) {
8189b69
		fd = atoi(argv[1]);
8189b69
		if (fd != 0) {
8189b69
			if (dup2(fd, 0) < 0)
8189b69
				abort();
8189b69
			close(fd);
8189b69
		}
8189b69
8189b69
		argv[1] = "0";
8189b69
	}
8189b69
8189b69
	execv("/usr/bin/consolehelper", argv);
8189b69
	abort();
8189b69
}