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;
|
||||
|
||||
mcmd = hio_dupbcstr(hio, cmd, HIO_NULL);
|
||||
if (!mcmd) goto oops;
|
||||
|
||||
if (HIO_UNLIKELY(!mcmd)) goto oops;
|
||||
|
||||
fcnt = hio_split_bcstr(mcmd, "", '\"', '\"', '\\');
|
||||
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
|
||||
{
|
||||
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;
|
||||
|
@ -111,8 +111,8 @@ static int dev_pty_make (hio_dev_t* dev, void* ctx)
|
||||
# error NOT IMPLEMENTED YET
|
||||
#endif
|
||||
|
||||
if (hio_makesyshndcloexec(hio, pfds[0]) <= -1) goto oops;
|
||||
if (hio_makesyshndcloexec(hio, pfds[1]) <= -1) goto oops;
|
||||
if (hio_makesyshndcloexec(hio, pfds[0]) <= -1 ||
|
||||
hio_makesyshndcloexec(hio, pfds[1]) <= -1) goto oops;
|
||||
|
||||
pid = fork();
|
||||
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 */
|
||||
pfds[0] = HIO_SYSHND_INVALID;
|
||||
|
||||
/*TODO: close all open file descriptors */
|
||||
/*TODO: close all open file descriptors */
|
||||
|
||||
setsid (); /* TODO: error check? */
|
||||
setpgid (0, 0);
|
||||
@ -160,7 +160,7 @@ static int dev_pty_make (hio_dev_t* dev, void* ctx)
|
||||
|
||||
oops:
|
||||
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;
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user