mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-27 23:42:51 +02:00
Merge branch 'ni/tuxbox' into ni/mp/tuxbox
Conflicts:
src/system/helpers.cpp
Origin commit data
------------------
Branch: ni/coolstream
Commit: c1803eacac
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-01-29 (Sun, 29 Jan 2017)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
License: GPL
|
||||
|
||||
(C) 2012-2013 the neutrino-hd developers
|
||||
(C) 2012-2015 Stefan Seyfried
|
||||
(C) 2012-2017 Stefan Seyfried
|
||||
|
||||
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
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <pty.h> /* forkpty*/
|
||||
#include <sys/ioctl.h>
|
||||
#include <inttypes.h>
|
||||
#include <sys/wait.h>
|
||||
@@ -352,6 +353,22 @@ FILE* my_popen( pid_t& pid, const char *cmdstring, const char *type)
|
||||
}
|
||||
return(fp);
|
||||
}
|
||||
|
||||
int run_pty(pid_t &pid, const char *cmdstring)
|
||||
{
|
||||
int master = -1;
|
||||
if ((pid = forkpty(&master, NULL, NULL, NULL)) < 0)
|
||||
return -1;
|
||||
else if (pid == 0) {
|
||||
int maxfd = getdtablesize();
|
||||
for(int i = 3; i < maxfd; i++)
|
||||
close(i);
|
||||
execl("/bin/sh", "sh", "-c", cmdstring, (char *)0);
|
||||
exit(0);
|
||||
}
|
||||
return master;
|
||||
}
|
||||
|
||||
#if 0
|
||||
int mkdirhier(const char *pathname, mode_t mode)
|
||||
{
|
||||
|
Reference in New Issue
Block a user