diff options
author | Renato Botelho <renato@netgate.com> | 2016-03-17 09:59:02 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2016-03-17 09:59:02 -0300 |
commit | 26579e8947bb764387ecc9b47dbe846b8eb476a4 (patch) | |
tree | 1a160679cf6b42ac86e8a46428b72718516eda5a /usr.bin/script/script.c | |
parent | a26e4b3de35515ec3eaf2eb76b001a6a502bf56c (diff) | |
parent | 5c5f0dbf8c72e3f9756938b33922f00eda1decd8 (diff) | |
download | FreeBSD-src-26579e8947bb764387ecc9b47dbe846b8eb476a4.zip FreeBSD-src-26579e8947bb764387ecc9b47dbe846b8eb476a4.tar.gz |
Merge remote-tracking branch 'origin/stable/10' into devel
Diffstat (limited to 'usr.bin/script/script.c')
-rw-r--r-- | usr.bin/script/script.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/usr.bin/script/script.c b/usr.bin/script/script.c index 4e5e313..c990849 100644 --- a/usr.bin/script/script.c +++ b/usr.bin/script/script.c @@ -80,7 +80,6 @@ static struct termios tt; static void done(int) __dead2; static void doshell(char **); -static void fail(void); static void finish(void); static void record(FILE *, char *, size_t, int); static void consume(FILE *, off_t, char *, int); @@ -221,13 +220,19 @@ main(int argc, char *argv[]) warn("fork"); done(1); } - if (child == 0) + if (child == 0) { + if (fflg) { + int pid; + + pid = getpid(); + if (ioctl(fm_fd, FILEMON_SET_PID, &pid) < 0) + err(1, "Cannot set filemon PID"); + } + doshell(argv); + } close(slave); - if (fflg && ioctl(fm_fd, FILEMON_SET_PID, &child) < 0) - err(1, "Cannot set filemon PID"); - start = tvec = time(0); readstdin = 1; for (;;) { @@ -336,14 +341,7 @@ doshell(char **av) execl(shell, shell, "-i", (char *)NULL); warn("%s", shell); } - fail(); -} - -static void -fail(void) -{ - (void)kill(0, SIGTERM); - done(1); + exit(1); } static void |