some minor fixes
This commit is contained in:
parent
5b2ffd6191
commit
ee89bb90c8
@ -88,8 +88,8 @@ static int make_param (hio_t* hio, const hio_bch_t* cmd, int flags, param_t* par
|
|||||||
hio_bch_t* mcmdptr;
|
hio_bch_t* mcmdptr;
|
||||||
|
|
||||||
mcmd = hio_dupbcstr(hio, cmd, HIO_NULL);
|
mcmd = hio_dupbcstr(hio, cmd, HIO_NULL);
|
||||||
if (!mcmd) goto oops;
|
if (HIO_UNLIKELY(!mcmd)) goto oops;
|
||||||
|
|
||||||
fcnt = hio_split_bcstr(mcmd, "", '\"', '\"', '\\');
|
fcnt = hio_split_bcstr(mcmd, "", '\"', '\"', '\\');
|
||||||
if (fcnt <= 0)
|
if (fcnt <= 0)
|
||||||
{
|
{
|
||||||
@ -105,7 +105,7 @@ static int make_param (hio_t* hio, const hio_bch_t* cmd, int flags, param_t* par
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
param->argv = hio_allocmem(hio, (fcnt + 1) * HIO_SIZEOF(argv[0]));
|
param->argv = hio_allocmem(hio, (fcnt + 1) * HIO_SIZEOF(argv[0]));
|
||||||
if (!param->argv) goto oops;
|
if (HIO_UNLIKELY(!param->argv)) goto oops;
|
||||||
}
|
}
|
||||||
|
|
||||||
mcmdptr = mcmd;
|
mcmdptr = mcmd;
|
||||||
|
@ -111,8 +111,8 @@ static int dev_pty_make (hio_dev_t* dev, void* ctx)
|
|||||||
# error NOT IMPLEMENTED YET
|
# error NOT IMPLEMENTED YET
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (hio_makesyshndcloexec(hio, pfds[0]) <= -1) goto oops;
|
if (hio_makesyshndcloexec(hio, pfds[0]) <= -1 ||
|
||||||
if (hio_makesyshndcloexec(hio, pfds[1]) <= -1) goto oops;
|
hio_makesyshndcloexec(hio, pfds[1]) <= -1) goto oops;
|
||||||
|
|
||||||
pid = fork();
|
pid = fork();
|
||||||
if (pid == -1)
|
if (pid == -1)
|
||||||
@ -127,7 +127,7 @@ static int dev_pty_make (hio_dev_t* dev, void* ctx)
|
|||||||
close (pfds[0]); /* close the pty master */
|
close (pfds[0]); /* close the pty master */
|
||||||
pfds[0] = HIO_SYSHND_INVALID;
|
pfds[0] = HIO_SYSHND_INVALID;
|
||||||
|
|
||||||
/*TODO: close all open file descriptors */
|
/*TODO: close all open file descriptors */
|
||||||
|
|
||||||
setsid (); /* TODO: error check? */
|
setsid (); /* TODO: error check? */
|
||||||
setpgid (0, 0);
|
setpgid (0, 0);
|
||||||
@ -160,7 +160,7 @@ static int dev_pty_make (hio_dev_t* dev, void* ctx)
|
|||||||
|
|
||||||
oops:
|
oops:
|
||||||
if (pfds[0] != HIO_SYSHND_INVALID) close (pfds[0]);
|
if (pfds[0] != HIO_SYSHND_INVALID) close (pfds[0]);
|
||||||
if (pfds[1] != HIO_SYSHND_INVALID) close (pfds[0]);
|
if (pfds[1] != HIO_SYSHND_INVALID) close (pfds[1]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -408,4 +408,3 @@ int hio_dev_pty_close (hio_dev_pty_t* dev)
|
|||||||
{
|
{
|
||||||
return hio_dev_ioctl((hio_dev_t*)dev, HIO_DEV_PTY_CLOSE, HIO_NULL);
|
return hio_dev_ioctl((hio_dev_t*)dev, HIO_DEV_PTY_CLOSE, HIO_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user